26 #include "viaio/Vlib.h"
27 #include "viaio/file.h"
30 #include <X11/Xfuncproto.h>
46 typedef struct V_GraphRec {
51 struct VNodestruct **table;
58 typedef struct VNodebaseStruct {
59 unsigned int hops: 31;
60 unsigned int visited: 1;
62 struct VAdjstruct *head;
63 } VNodeBaseRec, *VNodeBase;
65 typedef struct VNodestruct {
70 typedef struct VAdjstruct {
73 struct VAdjstruct *next;
74 } VAdjRec, *VAdjacency;
82 #define VGraphAttr "Graph"
83 #define VNGraphNodesAttr "nnodes"
84 #define VNNodeFieldsAttr "nfields"
85 #define VNNodeWeightsAttr "useWeights"
93 #define VGraphNNodes(graph) (graph->nnodes)
95 #define VGraphNFields(graph) (graph->nfields)
97 #define VGraphNSize(graph) (graph->size)
99 #define VGraphAttrList(graph) (graph->attributes)
101 #define VGraphGetNode(graph, nid) (graph->table[nid-1])
103 #define VGraphNodeIsFree(graph, nid) (graph->table[nid-1] == 0)
105 #define VNodeRepn(graph) (graph->node_repn)
107 #define VNodeSize(graph) \
108 (sizeof(VNodeBaseRec) + (graph->nfields * VRepnPrecision(graph->node_repn)) / 8)
110 #define VNodeTestVisit(node) (((VNodeBase)node)->visited == TRUE)
112 #define VNodeSetVisit(node) (((VNodeBase)node)->visited = TRUE)
114 #define VNodeClearVisit(node) (((VNodeBase)node)->visited = FALSE)
122 extern VGraph VCreateGraph (
123 #
if NeedFunctionPrototypes
131 extern VGraph VCopyGraph (
132 #
if NeedFunctionPrototypes
137 extern void VDestroyGraph (
138 #
if NeedFunctionPrototypes
143 extern int VReadGraphs (
144 #
if NeedFunctionPrototypes
151 extern VBoolean VWriteGraphs (
152 #
if NeedFunctionPrototypes
160 extern int VGraphLookupNode (
161 #
if NeedFunctionPrototypes
167 extern int VGraphAddNode (
168 #
if NeedFunctionPrototypes
174 extern int VGraphAddNodeAt (
175 #
if NeedFunctionPrototypes
182 extern int VGraphLinkNodes (
183 #
if NeedFunctionPrototypes
190 extern int VGraphUnlinkNodes (
191 #
if NeedFunctionPrototypes
198 extern VPointer VGraphFirstNode (
199 #
if NeedFunctionPrototypes
204 extern VPointer VGraphNextNode (
205 #
if NeedFunctionPrototypes
210 extern void VGraphClearVisit (
211 #
if NeedFunctionPrototypes
216 extern int VGraphResizeFields (
217 #
if NeedFunctionPrototypes
223 extern int VGraphNCycles (
224 #
if NeedFunctionPrototypes
229 extern void VGraphToggleNodesFrom (
230 #
if NeedFunctionPrototypes
236 extern void VDestroyNode (
237 #
if NeedFunctionPrototypes
243 extern void VGraphDestroyNodesFrom (
244 #
if NeedFunctionPrototypes
250 extern void VGraphClearHops (
251 #
if NeedFunctionPrototypes