[libgfc Index] [libgfc Hierarchy] [Headers]
GGraph The general graph class More...
#include <src/ggraph.h>
GGraph The general graph class. A graph has a list of nodes. Each node has its own list of wires that start from it. Many public methods have two versions, one based on the memory address of the nodes, one based on the id of the nodes. The second one is less efficient since a lookup based on the integer id is necessary. The advantage of id-based methods is that we can perform algorithms on disk-based (huge) graphs where the memory-address-based methods may fall short due to memory stress.
(The structure of the GNode/GWire/GGraph is similar to those in The Stanford Graphbase, Knuth '94.)
[public virtual]
add a node to the graph. The node id is automatically assigned by the graph.
[public virtual]
same as above, except use the given node id.
[public virtual]
delete a node (and all of related wires). The node object is completely vanished from the memory-space after this.
[public virtual]
same as above, provided for convenience.
[public virtual]
check if the given node is isolated or not connected to any other node.
[public virtual]
establish connection between orig and dest. For undirected graph this actually adds two wires to the graph, one from orig->dest, another dest->orig. Weight is the weight to be assigned to the new wire(s). The new wire corresponding to the new connection is returned.
[public virtual]
same as above, provided for convenience.
[public virtual]
disconnect a pair of nodes. For undirected it deletes two wires from the graph.
[public]
lookup and return the memory address of the node with the given id.
[public]
check wether a node is a root node. This is only meaningful for directed graphs. A root node is not the 'tip' or destination of any wires in the graph.
[public]
check if a node is a leaf node. This is only meaningful for directed graphs. A leaf node is a node that has no out-going wires.
[public]
check wether two nodes are neighbor. Neighboring nodes have a direct wire between them.
[public]
check wether two nodes are connected. Two nodes are connected if they are either 1) neighbors, or 2) there exists a path from nd1--->nd2. For digraph nd1 must be the origin node, and nd2 the destination node for the path.
[public]
calculate the diameter of the graph. The diameter of a graph is the longest path from one node to another.
[public]
find out the shortest path from orig to dest. A linked list of nodes on the desired path, starting with 'orig', is returned when successful. The utility data field GNode::z is used to link all the nodes on the path together. Also note that the weight is stored in each wire's GWire::w.f field.
[public]
check whether the graph is a planar one.
Documentation generated by lqian@lqian-sun on Wed Jul 14 09:36:10 EDT 1999 | Kdoc |