예제 #1
0
 /** Test whether this edge and @a e are equal.
  *
  * Equal edges represent the same undirected edge between two nodes.
  */
 bool operator==(const Edge& e) const {
   assert(e.graph_ != NULL and this->graph_ != NULL);
   if(graph_ == e.graph_ and
     ((node1_id_ == e.node1_id_ and Node2Id() == e.Node2Id()) or
     (Node2Id() == e.node1_id_ and node1_id_ == e.Node2Id()))) return true;
   return false;
 }
예제 #2
0
 /** Test whether this edge is less than @a e in a global order.
  * The order is according to the edge index.
  * This ordering function is useful for STL containers such as
  * std::map<>. It need not have any interpretive meaning.
  */
 bool operator<(const Edge& e) const {
   assert(e.graph_ != NULL and this->graph_ != NULL);
   size_type curmin = std::min(node1_id_, Node2Id());
   size_type curmax = std::max(node1_id_, Node2Id());
   size_type emin = std::min(e.node1_id_, e.Node2Id());
   size_type emax = std::max(e.node1_id_, e.Node2Id());
   if ((graph_ < e.graph_) or
 		((graph_ == e.graph_) and ((curmin < emin) or
 	   ((curmin == emin) and (curmax < emax))))) {
 	  return true;
 	}
   return false;
 }