INGOR
|
Graph by adjacent matrix. More...
Public Member Functions | |
ytAdjGraph * | ytAdjGraph_new (int nodes) |
Generates the new ytAdjGraph instance. | |
void | ytAdjGraph_delete (ytAdjGraph *this) |
Deletes the ytAdjGraph instance. | |
int | ytAdjGraph_numNodes (const ytAdjGraph *this) |
Returnts the number of nodes. | |
int | ytAdjGraph_numEdges (const ytAdjGraph *this) |
Returns the number of edges. | |
int | ytAdjGraph_checkEdge (const ytAdjGraph *this, int src, int dst) |
Checks if the specified edge exists in the graph. | |
int | ytAdjGraph_degree (const ytAdjGraph *this, int j) |
Returns the number of edges connected to the node. | |
int | ytAdjGraph_numParents (const ytAdjGraph *this, int j) |
Returns the number of parents of the specified node. | |
void | ytAdjGraph_addEdge (ytAdjGraph *this, int src, int dst) |
Adds an edge to the graph. | |
void | ytAdjGraph_removeEdge (ytAdjGraph *this, int src, int dst) |
Removes the edge. | |
ytGraphEdgeIter * | ytAdjGraph_edgeIter (const ytAdjGraph *this) |
Generates the ytGraphEdgeIter instance. | |
void | ytAdjGraph_edgeIterNext (const ytAdjGraph *this, ytGraphEdgeIter *iter) |
Graph by adjacent matrix.
void ytAdjGraph_addEdge | ( | ytAdjGraph * | this, |
int | src, | ||
int | dst | ||
) |
Adds an edge to the graph.
This does not check whether the src - dst edge exists already in the graph.
this | |
src | index of the source node. |
dst | index of the destination node. |
int ytAdjGraph_checkEdge | ( | const ytAdjGraph * | this, |
int | src, | ||
int | dst | ||
) |
Checks if the specified edge exists in the graph.
this | pointer to the ytAdjGraph instance. NULL acceptable. If so, this always returns 0. |
src | index of starting node of the edge. |
dst | index of ending node of the edge. |
int ytAdjGraph_numParents | ( | const ytAdjGraph * | this, |
int | j | ||
) |
Returns the number of parents of the specified node.
Note: This requires O(n) time where n is the number of nodes.
this | pointer to the ytArgGraph instance. |
j | node index. |
void ytAdjGraph_removeEdge | ( | ytAdjGraph * | this, |
int | src, | ||
int | dst | ||
) |
Removes the edge.
this | |
src | |
dst |