CMR
1.3.0
|
Classes | |
struct | CMR_GRAPH_NODE_DATA |
struct | CMR_GRAPH_ARC_DATA |
struct | CMR_GRAPH |
Typedefs | |
typedef int | CMR_GRAPH_NODE |
Reference to a node of CMR_GRAPH. More... | |
typedef int | CMR_GRAPH_EDGE |
Reference to an edge of CMR_GRAPH. More... | |
typedef int | CMR_GRAPH_ITER |
Reference to an edge iterator of CMR_GRAPH. More... | |
Functions | |
static size_t | CMRgraphMemNodes (CMR_GRAPH *graph) |
Returns number of nodes for which memory is allocated. More... | |
static size_t | CMRgraphNumNodes (CMR_GRAPH *graph) |
Returns number of nodes. More... | |
static size_t | CMRgraphMemEdges (CMR_GRAPH *graph) |
Returns number of edges for which memory is allocated. More... | |
static size_t | CMRgraphNumEdges (CMR_GRAPH *graph) |
Returns number of edges. More... | |
static CMR_GRAPH_NODE | CMRgraphEdgeU (CMR_GRAPH *graph, CMR_GRAPH_EDGE e) |
Returns node u of edge e . More... | |
static CMR_GRAPH_NODE | CMRgraphEdgeV (CMR_GRAPH *graph, CMR_GRAPH_EDGE e) |
Returns node v of edge e . More... | |
CMR_EXPORT CMR_ERROR | CMRgraphCreateEmpty (CMR *cmr, CMR_GRAPH **pgraph, int memNodes, int memEdges) |
Creates an empty graph. More... | |
CMR_EXPORT CMR_ERROR | CMRgraphFree (CMR *cmr, CMR_GRAPH **pgraph) |
Frees a graph. More... | |
CMR_EXPORT CMR_ERROR | CMRgraphClear (CMR *cmr, CMR_GRAPH *graph) |
Removes all nodes and columns, keeping the memory. More... | |
CMR_EXPORT CMR_ERROR | CMRgraphAddNode (CMR *cmr, CMR_GRAPH *graph, CMR_GRAPH_NODE *pnode) |
Adds a node to a graph. More... | |
CMR_EXPORT CMR_ERROR | CMRgraphAddEdge (CMR *cmr, CMR_GRAPH *graph, CMR_GRAPH_NODE u, CMR_GRAPH_NODE v, CMR_GRAPH_EDGE *pedge) |
Adds an edge to a graph. More... | |
CMR_EXPORT CMR_ERROR | CMRgraphDeleteNode (CMR *cmr, CMR_GRAPH *graph, CMR_GRAPH_NODE v) |
Removes node v and all its incident edges from graph . More... | |
CMR_EXPORT CMR_ERROR | CMRgraphDeleteEdge (CMR *cmr, CMR_GRAPH *graph, CMR_GRAPH_EDGE e) |
Removes edge e from graph . More... | |
static CMR_GRAPH_NODE | CMRgraphNodesFirst (CMR_GRAPH *graph) |
Returns a node iterator for iterating over all nodes. More... | |
static bool | CMRgraphNodesValid (CMR_GRAPH *graph, CMR_GRAPH_NODE v) |
Return true if and only if this v is not the last node in node iteration. More... | |
static CMR_GRAPH_NODE | CMRgraphNodesNext (CMR_GRAPH *graph, CMR_GRAPH_NODE v) |
Returns the next node after v . More... | |
static CMR_GRAPH_ITER | CMRgraphIncFirst (CMR_GRAPH *graph, CMR_GRAPH_NODE v) |
Returns an iterator for all edges incident to node v . More... | |
static bool | CMRgraphIncValid (CMR_GRAPH *graph, CMR_GRAPH_ITER i) |
Returns true if iterator i for all incident edges of some node is valid. More... | |
static CMR_GRAPH_ITER | CMRgraphIncNext (CMR_GRAPH *graph, CMR_GRAPH_ITER i) |
Returns the iterator following iterator i for all edges incident to some node. More... | |
static CMR_GRAPH_EDGE | CMRgraphIncEdge (CMR_GRAPH *graph, CMR_GRAPH_ITER i) |
Converts an iterator for edges incident to a node to the actual edge. More... | |
static CMR_GRAPH_NODE | CMRgraphIncSource (CMR_GRAPH *graph, CMR_GRAPH_ITER i) |
Returns the node of which iterator i traverses through incident edges. More... | |
static CMR_GRAPH_NODE | CMRgraphIncTarget (CMR_GRAPH *graph, CMR_GRAPH_ITER i) |
Returns the end node of the edge corresponding to this iterator i . More... | |
static CMR_GRAPH_ITER | CMRgraphEdgesNext (CMR_GRAPH *graph, CMR_GRAPH_ITER i) |
Returns iterator of next edge in list of all edges. More... | |
static CMR_GRAPH_ITER | CMRgraphEdgesFirst (CMR_GRAPH *graph) |
Returns iterator for all edges of graph . More... | |
static bool | CMRgraphEdgesValid (CMR_GRAPH *graph, CMR_GRAPH_ITER i) |
Returns true if and only if iterator i for all edges is valid. More... | |
static CMR_GRAPH_EDGE | CMRgraphEdgesEdge (CMR_GRAPH *graph, CMR_GRAPH_ITER i) |
Returns the actual edge, iterator i represents. More... | |
CMR_EXPORT CMR_ERROR | CMRgraphPrint (CMR_GRAPH *graph, FILE *stream) |
Prints the graph , writing to stream . More... | |
CMR_EXPORT CMR_ERROR | CMRgraphMergeNodes (CMR *cmr, CMR_GRAPH *graph, CMR_GRAPH_NODE u, CMR_GRAPH_NODE v) |
Merges two nodes u and v of graph . More... | |
CMR_EXPORT CMR_ERROR | CMRgraphCreateFromEdgeList (CMR *cmr, CMR_GRAPH **pgraph, CMR_ELEMENT **pedgeElements, char ***pnodeLabels, FILE *stream) |
CMR_EXPORT CMR_ERROR | CMRgraphCopy (CMR *cmr, CMR_GRAPH *graph, CMR_GRAPH **pcopy) |
Undirected graphs.
typedef int CMR_GRAPH_EDGE |
Reference to an edge of CMR_GRAPH.
typedef int CMR_GRAPH_ITER |
Reference to an edge iterator of CMR_GRAPH.
typedef int CMR_GRAPH_NODE |
Reference to a node of CMR_GRAPH.
CMR_EXPORT CMR_ERROR CMRgraphAddEdge | ( | CMR * | cmr, |
CMR_GRAPH * | graph, | ||
CMR_GRAPH_NODE | u, | ||
CMR_GRAPH_NODE | v, | ||
CMR_GRAPH_EDGE * | pedge | ||
) |
Adds an edge to a graph.
Adds an edge to a graph.
cmr | CMR environment. |
graph | Graph. |
u | One node of the edge. |
v | Other node of the edge. |
pedge | Pointer for storinge the new edge, or NULL . |
CMR_EXPORT CMR_ERROR CMRgraphAddNode | ( | CMR * | cmr, |
CMR_GRAPH * | graph, | ||
CMR_GRAPH_NODE * | pnode | ||
) |
Adds a node to a graph.
Adds a node to a graph.
cmr | CMR environment. |
graph | Graph. |
pnode | Pointer for storing the new node, or NULL . |
Removes all nodes and columns, keeping the memory.
cmr | CMR environment. |
graph | Graph structure. |
cmr | CMR environment. |
graph | Graph structure. |
pcopy | Pointer for storing the copied graph. |
CMR_EXPORT CMR_ERROR CMRgraphCreateEmpty | ( | CMR * | cmr, |
CMR_GRAPH ** | pgraph, | ||
int | memNodes, | ||
int | memEdges | ||
) |
Creates an empty graph.
cmr | CMR environment. |
pgraph | Pointer for storing the graph. |
memNodes | Allocate memory for this number of nodes. |
memEdges | Allocate memory for this number of edges. |
CMR_EXPORT CMR_ERROR CMRgraphCreateFromEdgeList | ( | CMR * | cmr, |
CMR_GRAPH ** | pgraph, | ||
CMR_ELEMENT ** | pedgeElements, | ||
char *** | pnodeLabels, | ||
FILE * | stream | ||
) |
cmr | CMR environment. |
pgraph | Pointer for storing the graph. |
pedgeElements | Pointer for storing element of each edge (may be NULL ). |
pnodeLabels | Pointer for storing string node labels (may be NULL ). |
stream | File stream to read from. |
CMR_EXPORT CMR_ERROR CMRgraphDeleteEdge | ( | CMR * | cmr, |
CMR_GRAPH * | graph, | ||
CMR_GRAPH_EDGE | e | ||
) |
Removes edge e
from graph
.
cmr | CMR environment. |
graph | Graph. |
e | Edge to be deleted. |
CMR_EXPORT CMR_ERROR CMRgraphDeleteNode | ( | CMR * | cmr, |
CMR_GRAPH * | graph, | ||
CMR_GRAPH_NODE | v | ||
) |
Removes node v
and all its incident edges from graph
.
cmr | CMR environment. |
graph | Graph. |
v | Node to be deleted. |
|
inlinestatic |
Returns the actual edge, iterator i
represents.
graph | Graph structure. |
i | Iterator for edges. |
|
inlinestatic |
Returns iterator for all edges of graph
.
graph | Graph. |
|
inlinestatic |
Returns iterator of next edge in list of all edges.
graph | Graph. |
i | Current edge iterator. |
|
inlinestatic |
Returns true
if and only if iterator i
for all edges is valid.
graph | Graph structure. |
i | Iterator for edges incident to a node. |
|
inlinestatic |
Returns node u of edge e
.
graph | Graph. |
e | Edge of graph . |
|
inlinestatic |
Returns node v of edge e
.
graph | Graph. |
e | Edge of graph . |
Frees a graph.
cmr | CMR environment. |
pgraph | Pointer to graph. |
|
inlinestatic |
Converts an iterator for edges incident to a node to the actual edge.
graph | Graph. |
i | Iterator for edges incident to a node. |
|
inlinestatic |
Returns an iterator for all edges incident to node v
.
graph | Graph. |
v | Node. |
|
inlinestatic |
Returns the iterator following iterator i
for all edges incident to some node.
graph | Graph. |
i | Iterator for edges incident to a node. |
|
inlinestatic |
Returns the node of which iterator i
traverses through incident edges.
graph | Graph structure. |
i | Iterator for edges incident to a node. |
|
inlinestatic |
Returns the end node of the edge corresponding to this iterator i
.
graph | Graph structure. |
i | Iterator for edges incident to a node. |
|
inlinestatic |
Returns true
if iterator i
for all incident edges of some node is valid.
graph | Graph structure. |
i | Iterator for edges incident to a node. |
|
inlinestatic |
Returns number of edges for which memory is allocated.
graph | Graph. |
|
inlinestatic |
Returns number of nodes for which memory is allocated.
graph | Graph. |
CMR_EXPORT CMR_ERROR CMRgraphMergeNodes | ( | CMR * | cmr, |
CMR_GRAPH * | graph, | ||
CMR_GRAPH_NODE | u, | ||
CMR_GRAPH_NODE | v | ||
) |
Merges two nodes u
and v
of graph
.
cmr | CMR environment. |
graph | Graph. |
u | First node. |
v | Second node. |
|
inlinestatic |
Returns a node iterator for iterating over all nodes.
graph | Graph. |
|
inlinestatic |
Returns the next node after v
.
graph | Graph. |
v | Node. |
|
inlinestatic |
Return true
if and only if this v
is not the last node in node iteration.
graph | Graph. |
v | Node. |
|
inlinestatic |
Returns number of edges.
graph | Graph. |
|
inlinestatic |
Returns number of nodes.
graph | Graph. |