|
|
Most Graph applications require the ability to retrieve Graph information. The following Graph member functions are defined for both the generic and user-derived Graph types:
const Set_of_p<Edge>& edges() const; // all Edges in the Graph const Set_of_p<Vertex>& vertices() const; // all Vertices in the Graph int contains(const Vertex* v) const; // Is v in the Graph? int contains(const Edge* e) const; // Is e in the Graph?
Then, for a Graph g and Vertex v1, the following operations are legal:
Set_of_p<Edge> eset = g.edges();// g is a previously // declared Graph if (g.contains(&v1)) ... ; // returns true if // g contains v1 etc.