-
Notifications
You must be signed in to change notification settings - Fork 0
Usage
Detailed usage of each function can be found here.
An abstract data type. A pointer to internal struct _bmgraph_t. Declared as typedef struct _bmgraph_t *bmgraph_t;
Declared as typedef uint32_t vertex_t.
Declared as typedef uint32_t uint_t. Used for size of graphs and tracking the index of bitmap matrix.
Malloc a _bmgraph_t struct and initialize all fields inside the struct.
On success, pointer to the malloc'd struct (a.k.a bmgraph_t) is returned. Otherwise NULL would be returned.
Create an edge from vertex from to vertex to.
On success, 0 is returned.
Remove the edge from vertex from to vertex to.
On success, 0 is returned.
Check if vertex from has an edge to to.
Returns 1 if there is an "edge" from from to to, 0 otherwise. Also returns 0 if g == NULL or from and to are invalid.
Find the in degree of vertex v.
Returns the in degree of vertex v. Returns -1 if an error occurs.
Find the out degree of vertex v.
Returns the out degree of vertex v. Returns -1 if an error occurs.
Print the bitmap matrix to stdout.
-
D_MTRX- print adjacency matrix -
D_LIST- print adjacency list -
D_READ- print in human-readable format (WIP)
Print matrix only:
bmgraph_t g = mkgraph(10);
mkedge(g, 1, 2);
show_graph(g, D_MTRX);
destroy_graph(g);Print matrix and list:
show_graph(g, D_MTRX | D_LIST);Free all memory allocated for g.