DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
The C++ Graph Classes: A Tutorial - Graph(C++) and Graph_alg(C++)

Graph Component Insertion and Removal

The following Graph member functions are defined for insertion and removal of Vertex and Edge components in both the generic and user-derived Graph types:

       int insert(Vertex* v);
       int insert(Edge* e);
       int remove(Vertex* v);
       int remove(Edge* e);

In our example, for a Module m and Transport_Time t, the following operations are legal:

       widget.insert(&m);
       widget.remove(&t);
       etc.

The Graph is not changed and the return value is false if any of the following three conditions exist:

All other values for Vertex or Edge will change the Graph and will return true.

Note that removing a Vertex or Edge from a Graph does not destroy it; likewise, inserting a Vertex or Edge into a Graph does not create it: static or dynamic creation of Vertices and Edges must take place prior to insertion into the Graph.


Next topic: Graph Information Retrieval
Previous topic: Graph Operators

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005