src/work/list_graph.h
changeset 359 8cc53a6b1e61
parent 335 999eb3cd7b49
child 368 0beed7a49063
equal deleted inserted replaced
10:487302c7f106 11:6ce7ebe65071
   503     class SymEdgeIt : public Edge {
   503     class SymEdgeIt : public Edge {
   504       friend class ListGraph;
   504       friend class ListGraph;
   505       bool out_or_in; //1 iff out, 0 iff in
   505       bool out_or_in; //1 iff out, 0 iff in
   506       //node_item* v;
   506       //node_item* v;
   507       //protected:
   507       //protected:
   508     public: //for alpar
   508     protected: //for alpar
   509       SymEdgeIt(const Node& _v) /*: v(_v.node)*/ { 
   509       SymEdgeIt(const Node& _v) /*: v(_v.node)*/ { 
   510 	out_or_in=1;
   510 	out_or_in=1;
   511 	edge=_v.node->_first_out_edge; 
   511 	edge=_v.node->_first_out_edge; 
   512 	if (!edge) { edge=_v.node->_first_in_edge; out_or_in=0; }
   512 	if (!edge) { edge=_v.node->_first_in_edge; out_or_in=0; }
   513       }
   513       }
   534       Node aNode() const { 
   534       Node aNode() const { 
   535 	return (out_or_in) ? Node(edge->_tail) : Node(edge->_head); }
   535 	return (out_or_in) ? Node(edge->_tail) : Node(edge->_head); }
   536       Node bNode() const { 
   536       Node bNode() const { 
   537 	return (out_or_in) ? Node(edge->_head) : Node(edge->_tail); }
   537 	return (out_or_in) ? Node(edge->_head) : Node(edge->_tail); }
   538     };
   538     };
   539 
       
   540   };
   539   };
   541 
   540 
   542 //   template< typename T >
   541   class UndirListGraph : public ListGraph {
   543 //   T ListGraph::first() const { 
   542     typedef SymEdgeIt OutEdgeIt;
   544 //     std::cerr << "Invalid use of template<typemane T> T ListGraph::first<T>();" << std::endl; 
   543     typedef SymEdgeIt InEdgeIt;
   545 //     return T(); 
   544   };
   546 //   }
       
   547 
       
   548 //   template<>
       
   549 //   ListGraph::NodeIt ListGraph::first<ListGraph::NodeIt>() const { 
       
   550 //     return firstNode(); 
       
   551 //   }
       
   552 
       
   553 //   template<>
       
   554 //   ListGraph::EdgeIt ListGraph::first<ListGraph::EdgeIt>() const { 
       
   555 //     return firstEdge(); 
       
   556 //   }
       
   557 
       
   558 //   template< typename T >
       
   559 //   T ListGraph::first(ListGraph::Node v) const {
       
   560 //     std::cerr << "Invalid use of template<typemane T> T ListGraph::first<T>(ListGRaph::Node);" << std::endl; 
       
   561 //     return T(); 
       
   562 //   } 
       
   563 
       
   564 //   template<>
       
   565 //   ListGraph::OutEdgeIt ListGraph::first<ListGraph::OutEdgeIt>(const ListGraph::Node v) const { 
       
   566 //     return firstOutEdge(v); 
       
   567 //   }
       
   568 
       
   569 //   template<>
       
   570 //   ListGraph::InEdgeIt ListGraph::first<ListGraph::InEdgeIt>(const ListGraph::Node v) const { 
       
   571 //     return firstInEdge(v); 
       
   572 //   }
       
   573 
       
   574 //   template<>
       
   575 //   ListGraph::SymEdgeIt ListGraph::first<ListGraph::SymEdgeIt>(const ListGraph::Node v) const { 
       
   576 //     return firstSymEdge(v); 
       
   577 //   }
       
   578 
       
   579 
   545 
   580 } //namespace hugo
   546 } //namespace hugo
   581 
   547 
   582 #endif //HUGO_LIST_GRAPH_H
   548 #endif //HUGO_LIST_GRAPH_H