GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
dglib/graph.c File Reference
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include "type.h"
#include "tree.h"
#include "graph.h"
#include "graph_v1.h"
#include "graph_v2.h"
#include "helpers.h"
Include dependency graph for dglib/graph.c:

Go to the source code of this file.

Macros

#define DGL_V2   1
 
#define __CIO_BEGIN   0
 
#define __CIO_W_HEADER   1
 
#define __CIO_W_NODEBUFFER   2
 
#define __CIO_W_EDGEBUFFER   3
 
#define __CIO_R_HEADER   4
 
#define __CIO_R_NODEBUFFER   5
 
#define __CIO_R_EDGEBUFFER   6
 
#define __CIO_END   7
 
#define MIN(x, y)   (((x)<(y))?x:y)
 

Functions

void dglResetStats (dglGraph_s *pgraph)
 
int dglInitialize (dglGraph_s *pGraph, dglByte_t Version, dglInt32_t NodeAttrSize, dglInt32_t EdgeAttrSize, dglInt32_t *pOpaqueSet)
 
int dglRelease (dglGraph_s *pGraph)
 
int dglUnflatten (dglGraph_s *pGraph)
 
int dglFlatten (dglGraph_s *pGraph)
 
dglInt32_tdglGetNode (dglGraph_s *pGraph, dglInt32_t nNodeId)
 
dglInt32_tdglNodeGet_OutEdgeset (dglGraph_s *pGraph, dglInt32_t *pnNode)
 
dglInt32_tdglNodeGet_InEdgeset (dglGraph_s *pGraph, dglInt32_t *pnNode)
 
dglInt32_t dglNodeGet_Id (dglGraph_s *pGraph, dglInt32_t *pnNode)
 
dglInt32_t dglNodeGet_Status (dglGraph_s *pGraph, dglInt32_t *pnNode)
 
dglInt32_tdglNodeGet_Attr (dglGraph_s *pGraph, dglInt32_t *pnNode)
 
void dglNodeSet_Attr (dglGraph_s *pGraph, dglInt32_t *pnNode, dglInt32_t *pnAttr)
 
int dglNodeGet_InDegree (dglGraph_s *pGraph, dglInt32_t *pnNode)
 
int dglNodeGet_OutDegree (dglGraph_s *pGraph, dglInt32_t *pnNode)
 
int dglNodeGet_Valence (dglGraph_s *pGraph, dglInt32_t *pnNode)
 
dglInt32_t dglEdgesetGet_EdgeCount (dglGraph_s *pGraph, dglInt32_t *pnEdgeset)
 
dglInt32_t dglEdgeGet_Cost (dglGraph_s *pGraph, dglInt32_t *pnEdge)
 
dglInt32_t dglEdgeGet_Id (dglGraph_s *pGraph, dglInt32_t *pnEdge)
 
dglInt32_tdglEdgeGet_Head (dglGraph_s *pGraph, dglInt32_t *pnEdge)
 
dglInt32_tdglEdgeGet_Tail (dglGraph_s *pGraph, dglInt32_t *pnEdge)
 
dglInt32_tdglEdgeGet_Attr (dglGraph_s *pGraph, dglInt32_t *pnEdge)
 
int dglEdgeSet_Attr (dglGraph_s *pGraph, dglInt32_t *pnAttr, dglInt32_t *pnEdge)
 
dglInt32_tdglGetEdge (dglGraph_s *pGraph, dglInt32_t nEdgeId)
 
int dglDelEdge (dglGraph_s *pGraph, dglInt32_t nEdgeId)
 
int dglAddEdge (dglGraph_s *pGraph, dglInt32_t nHead, dglInt32_t nTail, dglInt32_t nCost, dglInt32_t nEdge)
 
int dglAddEdgeX (dglGraph_s *pGraph, dglInt32_t nHead, dglInt32_t nTail, dglInt32_t nCost, dglInt32_t nEdge, void *pvHeadAttr, void *pvTailAttr, void *pvEdgeAttr, dglInt32_t nFlags)
 
int dglAddNode (dglGraph_s *pGraph, dglInt32_t nNodeId, void *pvNodeAttr, dglInt32_t nFlags)
 
int dglDelNode (dglGraph_s *pGraph, dglInt32_t nNodeId)
 
int dglWrite (dglGraph_s *pGraph, int fd)
 
int dglRead (dglGraph_s *pGraph, int fd)
 
int dglShortestPath (dglGraph_s *pGraph, dglSPReport_s **ppReport, dglInt32_t nStart, dglInt32_t nDestination, dglSPClip_fn fnClip, void *pvClipArg, dglSPCache_s *pCache)
 
int dglShortestDistance (dglGraph_s *pGraph, dglInt32_t *pnDistance, dglInt32_t nStart, dglInt32_t nDestination, dglSPClip_fn fnClip, void *pvClipArg, dglSPCache_s *pCache)
 
int dglDepthSpanning (dglGraph_s *pgraphInput, dglGraph_s *pgraphOutput, dglInt32_t nVertexNode, dglSpanClip_fn fnClip, void *pvClipArg)
 
int dglDepthComponents (dglGraph_s *pgraphInput, dglGraph_s *pgraphComponents, int cgraphComponents, dglSpanClip_fn fnClip, void *pvClipArg)
 
int dglMinimumSpanning (dglGraph_s *pgraphInput, dglGraph_s *pgraphOutput, dglInt32_t nVertexNode, dglSpanClip_fn fnClip, void *pvClipArg)
 
void dglFreeSPReport (dglGraph_s *pgraph, dglSPReport_s *pSPReport)
 
int dglInitializeSPCache (dglGraph_s *pGraph, dglSPCache_s *pCache)
 
void dglReleaseSPCache (dglGraph_s *pGraph, dglSPCache_s *pCache)
 
int dglErrno (dglGraph_s *pgraph)
 
char * dglStrerror (dglGraph_s *pgraph)
 
int dglGet_Version (dglGraph_s *pgraph)
 
void dglSet_Version (dglGraph_s *pgraph, int nVersion)
 
int dglGet_Endianess (dglGraph_s *pgraph)
 
int dglGet_NodeAttrSize (dglGraph_s *pgraph)
 
int dglGet_EdgeAttrSize (dglGraph_s *pgraph)
 
int dglGet_NodeCount (dglGraph_s *pgraph)
 
int dglGet_HeadNodeCount (dglGraph_s *pgraph)
 
int dglGet_TailNodeCount (dglGraph_s *pgraph)
 
int dglGet_AloneNodeCount (dglGraph_s *pgraph)
 
int dglGet_EdgeCount (dglGraph_s *pgraph)
 
int dglGet_State (dglGraph_s *pgraph)
 
dglInt32_tdglGet_Opaque (dglGraph_s *pgraph)
 
void dglSet_Opaque (dglGraph_s *pgraph, dglInt32_t *pOpaque)
 
int dglGet_NodeSize (dglGraph_s *pgraph)
 
int dglGet_EdgeSize (dglGraph_s *pgraph)
 
dglInt64_t dglGet_Cost (dglGraph_s *pgraph)
 
void dglSet_Cost (dglGraph_s *pgraph, dglInt64_t nnCost)
 
dglInt32_t dglGet_Family (dglGraph_s *pgraph)
 
void dglSet_Family (dglGraph_s *pgraph, dglInt32_t nFamily)
 
dglInt32_t dglGet_Options (dglGraph_s *pgraph)
 
void dglSet_Options (dglGraph_s *pgraph, dglInt32_t nOptions)
 
dglEdgePrioritizer_sdglGet_EdgePrioritizer (dglGraph_s *pGraph)
 
dglNodePrioritizer_sdglGet_NodePrioritizer (dglGraph_s *pGraph)
 
int dglNode_T_Initialize (dglNodeTraverser_s *pT, dglGraph_s *pGraph)
 
void dglNode_T_Release (dglNodeTraverser_s *pT)
 
dglInt32_tdglNode_T_First (dglNodeTraverser_s *pT)
 
dglInt32_tdglNode_T_Next (dglNodeTraverser_s *pT)
 
dglInt32_tdglNode_T_Find (dglNodeTraverser_s *pT, dglInt32_t nNodeId)
 
int dglEdge_T_Initialize (dglEdgeTraverser_s *pT, dglGraph_s *pGraph, dglEdgePrioritizer_s *pEdgePrioritizer)
 
void dglEdge_T_Release (dglEdgeTraverser_s *pT)
 
dglInt32_tdglEdge_T_First (dglEdgeTraverser_s *pT)
 
dglInt32_tdglEdge_T_Next (dglEdgeTraverser_s *pT)
 
int dglEdgeset_T_Initialize (dglEdgesetTraverser_s *pT, dglGraph_s *pGraph, dglInt32_t *pnEdgeset)
 
void dglEdgeset_T_Release (dglEdgesetTraverser_s *pT)
 
dglInt32_tdglEdgeset_T_First (dglEdgesetTraverser_s *pT)
 
dglInt32_tdglEdgeset_T_Next (dglEdgesetTraverser_s *pT)
 
int dglIOContextInitialize (dglGraph_s *pG, dglIOContext_s *pIO)
 
void dglIOContextRelease (dglIOContext_s *pIO)
 
int dglWriteChunk (dglIOContext_s *pIO, dglWriteChunk_fn pfn, void *pv)
 
int dglReadChunk (dglIOContext_s *pIO, dglByte_t *pbChunk, int cbChunk)
 

Macro Definition Documentation

#define __CIO_BEGIN   0

Definition at line 1554 of file dglib/graph.c.

Referenced by dglIOContextInitialize(), dglReadChunk(), and dglWriteChunk().

#define __CIO_END   7

Definition at line 1561 of file dglib/graph.c.

Referenced by dglReadChunk(), and dglWriteChunk().

#define __CIO_R_EDGEBUFFER   6

Definition at line 1560 of file dglib/graph.c.

Referenced by dglReadChunk().

#define __CIO_R_HEADER   4

Definition at line 1558 of file dglib/graph.c.

Referenced by dglReadChunk().

#define __CIO_R_NODEBUFFER   5

Definition at line 1559 of file dglib/graph.c.

Referenced by dglReadChunk().

#define __CIO_W_EDGEBUFFER   3

Definition at line 1557 of file dglib/graph.c.

Referenced by dglWriteChunk().

#define __CIO_W_HEADER   1

Definition at line 1555 of file dglib/graph.c.

Referenced by dglWriteChunk().

#define __CIO_W_NODEBUFFER   2

Definition at line 1556 of file dglib/graph.c.

Referenced by dglWriteChunk().

#define DGL_V2   1

Definition at line 31 of file dglib/graph.c.

#define MIN (   x,
  y 
)    (((x)<(y))?x:y)

Definition at line 1691 of file dglib/graph.c.

Referenced by dglReadChunk().

Function Documentation

int dglAddEdge ( dglGraph_s pGraph,
dglInt32_t  nHead,
dglInt32_t  nTail,
dglInt32_t  nCost,
dglInt32_t  nEdge 
)
int dglAddEdgeX ( dglGraph_s pGraph,
dglInt32_t  nHead,
dglInt32_t  nTail,
dglInt32_t  nCost,
dglInt32_t  nEdge,
void *  pvHeadAttr,
void *  pvTailAttr,
void *  pvEdgeAttr,
dglInt32_t  nFlags 
)
int dglAddNode ( dglGraph_s pGraph,
dglInt32_t  nNodeId,
void *  pvNodeAttr,
dglInt32_t  nFlags 
)
int dglDelEdge ( dglGraph_s pGraph,
dglInt32_t  nEdgeId 
)
int dglDelNode ( dglGraph_s pGraph,
dglInt32_t  nNodeId 
)
int dglEdge_T_Initialize ( dglEdgeTraverser_s pT,
dglGraph_s pGraph,
dglEdgePrioritizer_s pEdgePrioritizer 
)
int dglErrno ( dglGraph_s pgraph)

Definition at line 1155 of file dglib/graph.c.

References _dglGraph::iErrno.

void dglFreeSPReport ( dglGraph_s pgraph,
dglSPReport_s pSPReport 
)
int dglGet_AloneNodeCount ( dglGraph_s pgraph)

Definition at line 1256 of file dglib/graph.c.

References _dglGraph::cAlone.

dglInt64_t dglGet_Cost ( dglGraph_s pgraph)

Definition at line 1311 of file dglib/graph.c.

References _dglGraph::nnCost.

int dglGet_EdgeAttrSize ( dglGraph_s pgraph)

Definition at line 1236 of file dglib/graph.c.

References _dglGraph::EdgeAttrSize.

Referenced by dglDepthComponents(), dglDepthSpanning(), and dglMinimumSpanning().

int dglGet_EdgeCount ( dglGraph_s pgraph)
dglEdgePrioritizer_s* dglGet_EdgePrioritizer ( dglGraph_s pGraph)

Definition at line 1341 of file dglib/graph.c.

References _dglGraph::edgePrioritizer.

int dglGet_Endianess ( dglGraph_s pgraph)

Definition at line 1226 of file dglib/graph.c.

References _dglGraph::Endian.

dglInt32_t dglGet_Family ( dglGraph_s pgraph)

Definition at line 1321 of file dglib/graph.c.

References _dglGraph::nFamily.

int dglGet_HeadNodeCount ( dglGraph_s pgraph)

Definition at line 1246 of file dglib/graph.c.

References _dglGraph::cHead.

int dglGet_NodeAttrSize ( dglGraph_s pgraph)

Definition at line 1231 of file dglib/graph.c.

References _dglGraph::NodeAttrSize.

Referenced by dglDepthComponents(), dglDepthSpanning(), and dglMinimumSpanning().

dglNodePrioritizer_s* dglGet_NodePrioritizer ( dglGraph_s pGraph)

Definition at line 1346 of file dglib/graph.c.

References _dglGraph::nodePrioritizer.

dglInt32_t* dglGet_Opaque ( dglGraph_s pgraph)

Definition at line 1271 of file dglib/graph.c.

References _dglGraph::aOpaqueSet.

Referenced by dglDepthComponents(), dglDepthSpanning(), and dglMinimumSpanning().

dglInt32_t dglGet_Options ( dglGraph_s pgraph)

Definition at line 1331 of file dglib/graph.c.

References _dglGraph::nOptions.

int dglGet_State ( dglGraph_s pgraph)

Definition at line 1266 of file dglib/graph.c.

References _dglGraph::Flags.

int dglGet_TailNodeCount ( dglGraph_s pgraph)

Definition at line 1251 of file dglib/graph.c.

References _dglGraph::cTail.

int dglGet_Version ( dglGraph_s pgraph)

Definition at line 1217 of file dglib/graph.c.

References _dglGraph::Version.

Referenced by dglDepthComponents(), dglDepthSpanning(), and dglMinimumSpanning().

dglInt32_t* dglGetEdge ( dglGraph_s pGraph,
dglInt32_t  nEdgeId 
)
int dglInitializeSPCache ( dglGraph_s pGraph,
dglSPCache_s pCache 
)
int dglIOContextInitialize ( dglGraph_s pG,
dglIOContext_s pIO 
)
void dglIOContextRelease ( dglIOContext_s pIO)

Definition at line 1573 of file dglib/graph.c.

dglInt32_t* dglNodeGet_InEdgeset ( dglGraph_s pGraph,
dglInt32_t pnNode 
)
void dglNodeSet_Attr ( dglGraph_s pGraph,
dglInt32_t pnNode,
dglInt32_t pnAttr 
)
int dglRead ( dglGraph_s pGraph,
int  fd 
)
int dglRelease ( dglGraph_s pGraph)
void dglReleaseSPCache ( dglGraph_s pGraph,
dglSPCache_s pCache 
)
void dglResetStats ( dglGraph_s pgraph)

Definition at line 43 of file dglib/graph.c.

void dglSet_Cost ( dglGraph_s pgraph,
dglInt64_t  nnCost 
)

Definition at line 1316 of file dglib/graph.c.

References _dglGraph::nnCost.

void dglSet_Family ( dglGraph_s pgraph,
dglInt32_t  nFamily 
)

Definition at line 1326 of file dglib/graph.c.

References _dglGraph::nFamily.

void dglSet_Opaque ( dglGraph_s pgraph,
dglInt32_t pOpaque 
)

Definition at line 1276 of file dglib/graph.c.

References _dglGraph::aOpaqueSet.

void dglSet_Options ( dglGraph_s pgraph,
dglInt32_t  nOptions 
)

Definition at line 1336 of file dglib/graph.c.

References _dglGraph::nOptions.

void dglSet_Version ( dglGraph_s pgraph,
int  nVersion 
)

Definition at line 1221 of file dglib/graph.c.

References _dglGraph::Version.

int dglShortestDistance ( dglGraph_s pGraph,
dglInt32_t pnDistance,
dglInt32_t  nStart,
dglInt32_t  nDestination,
dglSPClip_fn  fnClip,
void *  pvClipArg,
dglSPCache_s pCache 
)
int dglShortestPath ( dglGraph_s pGraph,
dglSPReport_s **  ppReport,
dglInt32_t  nStart,
dglInt32_t  nDestination,
dglSPClip_fn  fnClip,
void *  pvClipArg,
dglSPCache_s pCache 
)
int dglUnflatten ( dglGraph_s pGraph)
int dglWrite ( dglGraph_s pGraph,
int  fd 
)