CMR  1.3.0
Loading...
Searching...
No Matches
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.
 
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.
 

Functions

static size_t CMRgraphMemNodes (CMR_GRAPH *graph)
 Returns number of nodes for which memory is allocated.
 
static size_t CMRgraphNumNodes (CMR_GRAPH *graph)
 Returns number of nodes.
 
static size_t CMRgraphMemEdges (CMR_GRAPH *graph)
 Returns number of edges for which memory is allocated.
 
static size_t CMRgraphNumEdges (CMR_GRAPH *graph)
 Returns number of edges.
 
static CMR_GRAPH_NODE CMRgraphEdgeU (CMR_GRAPH *graph, CMR_GRAPH_EDGE e)
 Returns node u of edge e.
 
static CMR_GRAPH_NODE CMRgraphEdgeV (CMR_GRAPH *graph, CMR_GRAPH_EDGE e)
 Returns node v of edge e.
 
CMR_EXPORT CMR_ERROR CMRgraphCreateEmpty (CMR *cmr, CMR_GRAPH **pgraph, int memNodes, int memEdges)
 Creates an empty graph.
 
CMR_EXPORT CMR_ERROR CMRgraphFree (CMR *cmr, CMR_GRAPH **pgraph)
 Frees a graph.
 
CMR_EXPORT CMR_ERROR CMRgraphClear (CMR *cmr, CMR_GRAPH *graph)
 Removes all nodes and columns, keeping the memory.
 
CMR_EXPORT CMR_ERROR CMRgraphAddNode (CMR *cmr, CMR_GRAPH *graph, CMR_GRAPH_NODE *pnode)
 Adds a node to a 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.
 
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_EXPORT CMR_ERROR CMRgraphDeleteEdge (CMR *cmr, CMR_GRAPH *graph, CMR_GRAPH_EDGE e)
 Removes edge e from graph.
 
static CMR_GRAPH_NODE CMRgraphNodesFirst (CMR_GRAPH *graph)
 Returns a node iterator for iterating over all nodes.
 
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.
 
static CMR_GRAPH_NODE CMRgraphNodesNext (CMR_GRAPH *graph, CMR_GRAPH_NODE v)
 Returns the next node after v.
 
static CMR_GRAPH_ITER CMRgraphIncFirst (CMR_GRAPH *graph, CMR_GRAPH_NODE v)
 Returns an iterator for all edges incident to node v.
 
static bool CMRgraphIncValid (CMR_GRAPH *graph, CMR_GRAPH_ITER i)
 Returns true if iterator i for all incident edges of some node is valid.
 
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.
 
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.
 
static CMR_GRAPH_NODE CMRgraphIncSource (CMR_GRAPH *graph, CMR_GRAPH_ITER i)
 Returns the node of which iterator i traverses through incident edges.
 
static CMR_GRAPH_NODE CMRgraphIncTarget (CMR_GRAPH *graph, CMR_GRAPH_ITER i)
 Returns the end node of the edge corresponding to this iterator i.
 
static CMR_GRAPH_ITER CMRgraphEdgesNext (CMR_GRAPH *graph, CMR_GRAPH_ITER i)
 Returns iterator of next edge in list of all edges.
 
static CMR_GRAPH_ITER CMRgraphEdgesFirst (CMR_GRAPH *graph)
 Returns iterator for all edges of graph.
 
static bool CMRgraphEdgesValid (CMR_GRAPH *graph, CMR_GRAPH_ITER i)
 Returns true if and only if iterator i for all edges is valid.
 
static CMR_GRAPH_EDGE CMRgraphEdgesEdge (CMR_GRAPH *graph, CMR_GRAPH_ITER i)
 Returns the actual edge, iterator i represents.
 
CMR_EXPORT CMR_ERROR CMRgraphPrint (CMR_GRAPH *graph, FILE *stream)
 Prints the graph, writing to stream.
 
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_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