src/work/list_graph.h
changeset 440 f92099d27236
parent 409 7ab7f083760a
child 443 178fb74b22d1
equal deleted inserted replaced
14:1a45aec4109f 15:797c99a05c5a
   366       _set_head(e.edge, head.node); 
   366       _set_head(e.edge, head.node); 
   367     }
   367     }
   368 
   368 
   369     /* stream operations, for testing purpose */
   369     /* stream operations, for testing purpose */
   370 
   370 
   371     friend std::ostream& operator<<(std::ostream& os, const Node& i) { 
   371 //     friend std::ostream& operator<<(std::ostream& os, const Node& i) { 
   372       if (i.valid())
   372 //       if (i.valid())
   373 	os << i.node->id; 
   373 // 	os << i.node->id; 
   374       else
   374 //       else
   375 	os << "invalid";
   375 // 	os << "invalid";
   376       return os; 
   376 //       return os; 
   377     }
   377 //     }
   378     friend std::ostream& operator<<(std::ostream& os, const Edge& i) { 
   378 //     friend std::ostream& operator<<(std::ostream& os, const Edge& i) { 
   379       if (i.valid()) 
   379 //       if (i.valid()) 
   380 	os << "(" << i.edge->_tail->id << "--" << i.edge->id << "->" << i.edge->_head->id << ")"; 
   380 // 	os << "(" << i.edge->_tail->id << "--" << i.edge->id << "->" << i.edge->_head->id << ")"; 
   381       else 
   381 //       else 
   382 	os << "invalid";
   382 // 	os << "invalid";
   383       return os; 
   383 //       return os; 
   384     }
   384 //     }
   385 
   385 
   386     class Node {
   386     class Node {
   387       friend class ListGraph;
   387       friend class ListGraph;
   388       template <typename T> friend class NodeMap;
   388       template <typename T> friend class NodeMap;
   389 
   389 
   544       Node bNode() const { 
   544       Node bNode() const { 
   545 	return (out_or_in) ? Node(edge->_head) : Node(edge->_tail); }
   545 	return (out_or_in) ? Node(edge->_head) : Node(edge->_tail); }
   546     };
   546     };
   547   };
   547   };
   548 
   548 
       
   549   std::ostream& operator<<(std::ostream& os, const ListGraph::Node& i) { 
       
   550     if (i.valid())
       
   551       os << i.node->id; 
       
   552     else
       
   553       os << "invalid";
       
   554     return os; 
       
   555   }
       
   556   std::ostream& operator<<(std::ostream& os, const ListGraph::Edge& i) { 
       
   557     if (i.valid()) 
       
   558       os << "(" << i.edge->_tail->id << "--" << i.edge->id << "->" << i.edge->_head->id << ")"; 
       
   559     else 
       
   560       os << "invalid";
       
   561     return os; 
       
   562   }
       
   563 
   549   class UndirListGraph : public ListGraph {
   564   class UndirListGraph : public ListGraph {
   550   public:
   565   public:
   551     typedef SymEdgeIt OutEdgeIt;
   566     typedef SymEdgeIt OutEdgeIt;
   552     typedef SymEdgeIt InEdgeIt;
   567     typedef SymEdgeIt InEdgeIt;
   553   };
   568   };