CMR  1.3.0
Classes | Typedefs | Functions
graph.h File Reference

Functionality for graphs. More...

#include <cmr/env.h>
#include <cmr/element.h>
#include <stdio.h>

Go to the source code of this file.

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)
 

Detailed Description

Functionality for graphs.

Author
Matthias Walter