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

Vertex Information Retrieval

The following Vertex member functions are defined for both the generic and user-derived Vertex types:

       Set_of_p<Graph> graphs() const;
          // Which Graphs include this Vertex?
       int in_graph(const Graph& g) const;
          // Is this Vertex in g?

There are also a set of member functions that retrieve information about the Edges that are associated with this Vertex:

       Set_of_p<Edge> edges() const;
           // all Edges attached to this Vertex,
           // over all Graphs
       Set_of_p<Edge> in_edges() const;
           // all in Edges attached to this Vertex
       Set_of_p<Edge> out_edges() const;
           // all out Edges attached to this Vertex
       Set_of_p<Edge> loop_edges() const;
           // all loop Edges attached to this Vertex

and the Edges that are associated with this Vertex in a given Graph g:

       Set_of_p<Edge> edges_g(const Graph& g) const;
           // all Edges attached to this Vertex in g
       Set_of_p<Edge> in_edges_g(const Graph& g) const;
           // all in Edges attached to this Vertex in g
       Set_of_p<Edge> out_edges_g(const Graph& g) const;
           // all out Edges attached to this Vertex in g
       Set_of_p<Edge> loop_edges_g(const Graph& g) const;
           // all loop Edges attached to this Vertex in g

Then, for a Graph g1 and Vertex v the following operations are legal:

       Set_of_p<Edge> eset = v.edges_g(g1);
       if (v.in_graph(g1)) ... ;
       etc.

For instance, in our example, we might want to retrieve the edges associated with Module J over all Graphs. We would simple invoke

       mod("J")->edges();

Next topic: Vertex Traversal Support
Previous topic: Vertex Operators

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