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

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

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004