>
Graph classGTS Library Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#define GTS_GNODE_NEIGHBOR(n,e) (GTS_GEDGE (e)->n1 == n ? GTS_GEDGE (e)->n2 : GTS_GEDGE (e)->n2 == n ? GTS_GEDGE (e)->n1 : NULL) |
n : | |
e : |
GtsGNode* gts_gnode_new (GtsGNodeClass *klass); |
klass : | a GtsGNodeClass. |
Returns : | a new GtsGNode. |
void gts_gnode_foreach_edge (GtsGNode *n, GtsGraph *g, GtsFunc func, |
Calls func for each GtsGEdge connecting n to another GtsGNode (belonging to g if g is not NULL.
void gts_gnode_foreach_neighbor (GtsGNode *n, GtsGraph *g, GtsFunc func, |
Calls func for each neighbor GtsGNode of n (belonging to g if g is not NULL.
|
n : | a GtsGNode. |
Returns : | the weight of n as defined by the |
GtsGEdge* gts_gedge_new (GtsGEdgeClass *klass, GtsGNode *n1, GtsGNode *n2); |
klass : | a GtsGEdgeClass. |
n1 : | a GtsGNode. |
n2 : | another GtsGNode. |
Returns : | a new GtsGEdge linking n1 and n2. |
|
e : | a GtsGEdge. |
Returns : | the weight of edge e as defined by the |
struct GtsGraph { GtsHashContainer object; GtsGNodeClass * node_class; GtsGEdgeClass * edge_class; }; |
GtsGraph* gts_graph_new (GtsGraphClass *klass, GtsGNodeClass *node_class, GtsGEdgeClass *edge_class); |
klass : | a GtsGraphClass. |
node_class : | a GtsGNodeClass. |
edge_class : | a GtsGEdgeClass. |
Returns : | a new GtsGraph using node_class and edge_class as node types. |
|
Adds to g the data read from fp. The format of the file pointed to by fp is as described in gts_graph_write().
|
Adds to g the nodes and edges defined in the file pointed to by
fp. This file must use the Jostle "graph" ASCII format.
The nodes created are of type
void gts_graph_write (GtsGraph *g, |
Writes in the file fp an ASCII representation of g. The file format is as follows.
All the lines beginning with GTS_COMMENTS are ignored. The first line contains two unsigned integers separated by spaces. The first integer is the number of nodes, nn, the second is the number of edges, ne.
Follows nn lines containing node description. Follows ne lines containing the two indices (starting from one) of the nodes of each edge.
The format described above is the least common denominator to all
GTS files. Consistent with an object-oriented approach, the GTS
file format is extensible. Each of the lines of the file can be
extended with user-specific attributes accessible through the
g : | a GtsGraph. |
fp : | a file pointer. |
void gts_graph_write_dot (GtsGraph *g, |
Writes in the file fp an ASCII representation of g in the dot format of AT&T Bell Labs.
g : | a GtsGraph. |
fp : | a file pointer. |
void gts_graph_print_stats (GtsGraph *g, |
Writes to fp a summary of the properties of g.
g : | a GtsGraph. |
fp : | a file pointer. |
void gts_graph_foreach_edge (GtsGraph *g, GtsFunc func, |
Calls func for each GtsEdge of g.
GtsGraphTraverse* gts_graph_traverse_new (GtsGraph *g, GtsGNode *n, GtsTraverseType type, |
g : | a GtsGraph. |
n : | a GtsGNode belonging to g. |
type : | the type of traversal. |
reinit : | if TRUE, the traversal is reinitialized. |
Returns : | a new GtsGraphTraverse initialized for the traversal of g of type type, starting from n. |
GtsGNode* gts_graph_traverse_next (GtsGraphTraverse *t); |
t : | a GtsGraphTraverse. |
Returns : | the next GtsGNode of the traversal defined by t or NULL if the traversal is complete. |
GtsGNode* gts_graph_traverse_what_next (GtsGraphTraverse *t); |
t : | a GtsGraphTraverse. |
Returns : | the next GtsGNode of the traversal defined by t or NULL if the traversal is complete but without advancing the traversal. |
void gts_graph_traverse_destroy (GtsGraphTraverse *t); |
Frees all the memory allocated for t.
t : | a GtsGraphTraverse. |
|
g : | a GtsGraph. |
Returns : | the number of edges of g connecting nodes belonging to g to nodes not belonging to g. |
|
g : | a GtsGraph. |
Returns : | the sum of the weights of the edges of g connecting nodes belonging to g to nodes not belonging to g. |
|
g : | a GtsGraph. |
Returns : | the weight of graph g as defined by the |
GtsFNode* gts_fnode_new (GtsFNodeClass *klass, GtsFace *f); |
klass : | a GtsFNodeClass. |
f : | a GtsFace. |
Returns : | a new GtsFNode associated with face f. |
GtsGraph* gts_surface_graph_new (GtsGraphClass *klass, GtsSurface *s); |
klass : | a GtsGraphClass. |
s : | a GtsSurface. |
Returns : | a new GtsGraph representing the connectivity of the faces
of s. This graph uses |
GtsSurface* gts_surface_graph_surface (GtsGraph *surface_graph, GtsSurface *s); |
surface_graph : | a GtsGraph using |
s : | a GtsSurface. |
Returns : | a new GtsSurface using the same classes as s and composed of the faces defined by surface_graph. |
GtsGraph* gts_segments_graph_new (GtsGraphClass *klass, |
klass : | a GtsGraphClass. |
segments : | a list of GtsSegment. |
Returns : | a new GtsGraph representing the connectivity of the segments in segments. |