next up previous contents
Next: Queue Up: Algorithms Previous: Wrapping the New Algorithm

Edge

Edge objects use the flexibility of the Collection hierarchy to allow any given edge to be directed or undirected. A pointer to a Collection of Vertex pointers is stored in the Edge object. If this pointer points to a sequence, then the edge takes on properties of a directed edge. Otherwise the edge behaves as an undirected edge. Thus, directed hyperedges are simply defined to be sequences of vertices of varying length. As described briefly in the Vertex methods above, the inNeighbors() of a Vertex object v with respect to a directed Edge object e are those Vertices which occur before v in the e's vertex sequence. If, on the other hand, Edge e is undirected, the inNeighbors() of v with respect to e are defined to be all $\{w : (w \in e) \wedge (w \neq v)\}$.The outNeighbors() of v with respect to e are defined similarly, except that in the directed case, the neighboring vertices are those found after v in e. Like Vertex objects, Edge objects are never constructed explicitly by the programmer. See the Graph methods for adding vertices.

2. Operations






  ~Edge ()



The destructor for the vertex Collection object is called.









Bool hasVertex (Vertex* v)



Returns TRUE is v is a member of the vertex Collection.









Vertex* sourceVertex ()



Returns a pointer to the first Vertex object in the vertex Collection. Note that this implies that it returns the smallest Vertex object in lexicographic order if the Collection is a Set. The time complexity depends on the Container used to store the elements.









Vertex* sinkVertex ()



Returns a pointer to the last Vertex object in the vertex Collection. Note that this implies that it returns the largest Vertex object in lexicographic order if the Collection is a Set. The time complexity depends on the Container used to store the elements.









Sequence<Vertex> otherVertices (Vertex* v)



Return a Sequence object containing all vertices in the edge except v (in the same order in which they appear in the edge). O(s), where s is the cardinality of the largest edge.









void replace (Vertex *old_v, Vertex *new_v)



This method is used by the MHyperGraph methods to manipulate subgraphs. It should never be called by the programmer. NEEDS TO BE MADE PRIVATE, BUT THE PROBLEM IS THAT THE PARSER NEEDS ACCESS.









Collection<Vertex*>* vertices()  const



Return a pointer to the Collection of vertices. O(1)









DataType type () const



Return either EDGEUND or EDGEDIR depending on the type of Collection used to store vertices. (see general.h) It shouldn't normally be necessary to call this.









Bool operator==(const Vertex&) const  
Bool operator<=(const Vertex&) const  
Bool operator< (const Vertex&) const  
Bool operator>=(const Vertex&) const  
Bool operator> (const Vertex&) const  
Bool operator!=(const Vertex&) const  



Compare the current edge with another based on lexicographic ordering of edge names.









void saveToFile (ofstream& fout, int indent)



This method outputs the infomation associated with the current edge, including its attributes. It is not generally called by the programmer; MHyperGraph::saveToFile() calls it while writing out a graph.









friend ostream& operator<<  (ostream& stream, const Edge& v)



Output the Collection containing the vertices to a stream.









 
next up previous contents
Next: Queue Up: Algorithms Previous: Wrapping the New Algorithm
RHS Linux User
1/26/1998