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.

Defines

#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)


Define Documentation

#define __CIO_BEGIN   0

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

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

#define __CIO_END   7

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

Referenced by dglReadChunk(), and dglWriteChunk().

#define __CIO_R_EDGEBUFFER   6

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

Referenced by dglReadChunk().

#define __CIO_R_HEADER   4

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

Referenced by dglReadChunk().

#define __CIO_R_NODEBUFFER   5

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

Referenced by dglReadChunk().

#define __CIO_W_EDGEBUFFER   3

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

Referenced by dglWriteChunk().

#define __CIO_W_HEADER   1

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

Referenced by dglWriteChunk().

#define __CIO_W_NODEBUFFER   2

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

Referenced by dglWriteChunk().

#define DGL_V2   1

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

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

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

Referenced by dglReadChunk(), and RTreeCombineRect().


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 dglDepthComponents ( dglGraph_s pgraphInput,
dglGraph_s pgraphComponents,
int  cgraphComponents,
dglSpanClip_fn  fnClip,
void *  pvClipArg 
)

int dglDepthSpanning ( dglGraph_s pgraphInput,
dglGraph_s pgraphOutput,
dglInt32_t  nVertexNode,
dglSpanClip_fn  fnClip,
void *  pvClipArg 
)

dglInt32_t* dglEdge_T_First ( dglEdgeTraverser_s pT  ) 

int dglEdge_T_Initialize ( dglEdgeTraverser_s pT,
dglGraph_s pGraph,
dglEdgePrioritizer_s pEdgePrioritizer 
)

dglInt32_t* dglEdge_T_Next ( dglEdgeTraverser_s pT  ) 

void dglEdge_T_Release ( dglEdgeTraverser_s pT  ) 

dglInt32_t* dglEdgeGet_Attr ( dglGraph_s pGraph,
dglInt32_t pnEdge 
)

dglInt32_t dglEdgeGet_Cost ( dglGraph_s pGraph,
dglInt32_t pnEdge 
)

dglInt32_t* dglEdgeGet_Head ( dglGraph_s pGraph,
dglInt32_t pnEdge 
)

dglInt32_t dglEdgeGet_Id ( dglGraph_s pGraph,
dglInt32_t pnEdge 
)

dglInt32_t* dglEdgeGet_Tail ( dglGraph_s pGraph,
dglInt32_t pnEdge 
)

int dglEdgeSet_Attr ( dglGraph_s pGraph,
dglInt32_t pnAttr,
dglInt32_t pnEdge 
)

dglInt32_t* dglEdgeset_T_First ( dglEdgesetTraverser_s pT  ) 

int dglEdgeset_T_Initialize ( dglEdgesetTraverser_s pT,
dglGraph_s pGraph,
dglInt32_t pnEdgeset 
)

dglInt32_t* dglEdgeset_T_Next ( dglEdgesetTraverser_s pT  ) 

void dglEdgeset_T_Release ( dglEdgesetTraverser_s pT  ) 

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

dglInt32_t dglEdgesetGet_EdgeCount ( dglGraph_s pGraph,
dglInt32_t pnEdgeset 
)

int dglErrno ( dglGraph_s pgraph  ) 

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

References _dglGraph::iErrno.

Referenced by main().

int dglFlatten ( dglGraph_s pGraph  ) 

void dglFreeSPReport ( dglGraph_s pgraph,
dglSPReport_s pSPReport 
)

int dglGet_AloneNodeCount ( dglGraph_s pgraph  ) 

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

References _dglGraph::cAlone.

dglInt64_t dglGet_Cost ( dglGraph_s pgraph  ) 

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

References _dglGraph::nnCost.

int dglGet_EdgeAttrSize ( dglGraph_s pgraph  ) 

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

References _dglGraph::EdgeAttrSize.

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

int dglGet_EdgeCount ( dglGraph_s pgraph  ) 

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

References _dglGraph::cEdge.

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

dglEdgePrioritizer_s* dglGet_EdgePrioritizer ( dglGraph_s pGraph  ) 

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

References _dglGraph::edgePrioritizer.

Referenced by main().

int dglGet_EdgeSize ( dglGraph_s pgraph  ) 

int dglGet_Endianess ( dglGraph_s pgraph  ) 

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

References _dglGraph::Endian.

dglInt32_t dglGet_Family ( dglGraph_s pgraph  ) 

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

References _dglGraph::nFamily.

int dglGet_HeadNodeCount ( dglGraph_s pgraph  ) 

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

References _dglGraph::cHead.

int dglGet_NodeAttrSize ( dglGraph_s pgraph  ) 

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

References _dglGraph::NodeAttrSize.

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

int dglGet_NodeCount ( dglGraph_s pgraph  ) 

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

References _dglGraph::cNode.

dglNodePrioritizer_s* dglGet_NodePrioritizer ( dglGraph_s pGraph  ) 

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

References _dglGraph::nodePrioritizer.

int dglGet_NodeSize ( dglGraph_s pgraph  ) 

dglInt32_t* dglGet_Opaque ( dglGraph_s pgraph  ) 

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

References _dglGraph::aOpaqueSet.

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

dglInt32_t dglGet_Options ( dglGraph_s pgraph  ) 

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

References _dglGraph::nOptions.

int dglGet_State ( dglGraph_s pgraph  ) 

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

References _dglGraph::Flags.

int dglGet_TailNodeCount ( dglGraph_s pgraph  ) 

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

References _dglGraph::cTail.

int dglGet_Version ( dglGraph_s pgraph  ) 

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

References _dglGraph::Version.

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

dglInt32_t* dglGetEdge ( dglGraph_s pGraph,
dglInt32_t  nEdgeId 
)

dglInt32_t* dglGetNode ( dglGraph_s pGraph,
dglInt32_t  nNodeId 
)

int dglInitialize ( dglGraph_s pGraph,
dglByte_t  Version,
dglInt32_t  NodeAttrSize,
dglInt32_t  EdgeAttrSize,
dglInt32_t pOpaqueSet 
)

int dglInitializeSPCache ( dglGraph_s pGraph,
dglSPCache_s pCache 
)

int dglIOContextInitialize ( dglGraph_s pG,
dglIOContext_s pIO 
)

void dglIOContextRelease ( dglIOContext_s pIO  ) 

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

int dglMinimumSpanning ( dglGraph_s pgraphInput,
dglGraph_s pgraphOutput,
dglInt32_t  nVertexNode,
dglSpanClip_fn  fnClip,
void *  pvClipArg 
)

dglInt32_t* dglNode_T_Find ( dglNodeTraverser_s pT,
dglInt32_t  nNodeId 
)

dglInt32_t* dglNode_T_First ( dglNodeTraverser_s pT  ) 

int dglNode_T_Initialize ( dglNodeTraverser_s pT,
dglGraph_s pGraph 
)

dglInt32_t* dglNode_T_Next ( dglNodeTraverser_s pT  ) 

void dglNode_T_Release ( dglNodeTraverser_s pT  ) 

dglInt32_t* dglNodeGet_Attr ( dglGraph_s pGraph,
dglInt32_t pnNode 
)

dglInt32_t dglNodeGet_Id ( dglGraph_s pGraph,
dglInt32_t pnNode 
)

int dglNodeGet_InDegree ( dglGraph_s pGraph,
dglInt32_t pnNode 
)

dglInt32_t* dglNodeGet_InEdgeset ( dglGraph_s pGraph,
dglInt32_t pnNode 
)

int dglNodeGet_OutDegree ( dglGraph_s pGraph,
dglInt32_t pnNode 
)

dglInt32_t* dglNodeGet_OutEdgeset ( dglGraph_s pGraph,
dglInt32_t pnNode 
)

dglInt32_t dglNodeGet_Status ( dglGraph_s pGraph,
dglInt32_t pnNode 
)

int dglNodeGet_Valence ( 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 
)

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

References DGL_ERR_Read, DGL_ERR_VersionNotSupported, dgl_read_V1(), dgl_read_V2(), and _dglGraph::iErrno.

Referenced by main().

int dglReadChunk ( dglIOContext_s pIO,
dglByte_t pbChunk,
int  cbChunk 
)

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 1202 of file dglib/graph.c.

References _dglGraph::nnCost.

void dglSet_Family ( dglGraph_s pgraph,
dglInt32_t  nFamily 
)

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

References _dglGraph::nFamily.

void dglSet_Opaque ( dglGraph_s pgraph,
dglInt32_t pOpaque 
)

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

References _dglGraph::aOpaqueSet.

void dglSet_Options ( dglGraph_s pgraph,
dglInt32_t  nOptions 
)

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

References _dglGraph::nOptions.

Referenced by main().

void dglSet_Version ( dglGraph_s pgraph,
int  nVersion 
)

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

References _dglGraph::Version.

Referenced by main().

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 
)

char* dglStrerror ( dglGraph_s pgraph  ) 

int dglUnflatten ( dglGraph_s pGraph  ) 

int dglWrite ( dglGraph_s pGraph,
int  fd 
)

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

References DGL_ERR_BadVersion, dgl_write_V1(), dgl_write_V2(), _dglGraph::iErrno, and _dglGraph::Version.

Referenced by main().

int dglWriteChunk ( dglIOContext_s pIO,
dglWriteChunk_fn  pfn,
void *  pv 
)


Generated on Sun Apr 6 17:32:47 2008 for GRASS by  doxygen 1.5.5