lemon/list_graph.h
changeset 2072 224d3781b00b
parent 1999 2ff283124dfc
child 2076 10681ee9d8ae
equal deleted inserted replaced
22:609e102a9e69 23:254e59a01490
    64     class Node {
    64     class Node {
    65       friend class ListGraphBase;
    65       friend class ListGraphBase;
    66     protected:
    66     protected:
    67 
    67 
    68       int id;
    68       int id;
    69       Node(int pid) { id = pid;}
    69       explicit Node(int pid) { id = pid;}
    70 
    70 
    71     public:
    71     public:
    72       Node() {}
    72       Node() {}
    73       Node (Invalid) { id = -1; }
    73       Node (Invalid) { id = -1; }
    74       bool operator==(const Node& node) const {return id == node.id;}
    74       bool operator==(const Node& node) const {return id == node.id;}
    79     class Edge {
    79     class Edge {
    80       friend class ListGraphBase;
    80       friend class ListGraphBase;
    81     protected:
    81     protected:
    82 
    82 
    83       int id;
    83       int id;
    84       Edge(int pid) { id = pid;}
    84       explicit Edge(int pid) { id = pid;}
    85 
    85 
    86     public:
    86     public:
    87       Edge() {}
    87       Edge() {}
    88       Edge (Invalid) { id = -1; }
    88       Edge (Invalid) { id = -1; }
    89       bool operator==(const Edge& edge) const {return id == edge.id;}
    89       bool operator==(const Edge& edge) const {return id == edge.id;}
   108     
   108     
   109     /// Maximum edge ID.
   109     /// Maximum edge ID.
   110     ///\sa id(Edge)
   110     ///\sa id(Edge)
   111     int maxEdgeId() const { return edges.size()-1; }
   111     int maxEdgeId() const { return edges.size()-1; }
   112 
   112 
   113     Node source(Edge e) const { return edges[e.id].source; }
   113     Node source(Edge e) const { return Node(edges[e.id].source); }
   114     Node target(Edge e) const { return edges[e.id].target; }
   114     Node target(Edge e) const { return Node(edges[e.id].target); }
   115 
   115 
   116 
   116 
   117     void first(Node& node) const { 
   117     void first(Node& node) const { 
   118       node.id = first_node;
   118       node.id = first_node;
   119     }
   119     }
   674     class Node {
   674     class Node {
   675       friend class ListBpUGraphBase;
   675       friend class ListBpUGraphBase;
   676     protected:
   676     protected:
   677       int id;
   677       int id;
   678 
   678 
   679       Node(int _id) : id(_id) {}
   679       explicit Node(int _id) : id(_id) {}
   680     public:
   680     public:
   681       Node() {}
   681       Node() {}
   682       Node(Invalid) { id = -1; }
   682       Node(Invalid) { id = -1; }
   683       bool operator==(const Node i) const {return id==i.id;}
   683       bool operator==(const Node i) const {return id==i.id;}
   684       bool operator!=(const Node i) const {return id!=i.id;}
   684       bool operator!=(const Node i) const {return id!=i.id;}
   688     class Edge {
   688     class Edge {
   689       friend class ListBpUGraphBase;
   689       friend class ListBpUGraphBase;
   690     protected:
   690     protected:
   691       int id;
   691       int id;
   692 
   692 
   693       Edge(int _id) { id = _id;}
   693       explicit Edge(int _id) { id = _id;}
   694     public:
   694     public:
   695       Edge() {}
   695       Edge() {}
   696       Edge (Invalid) { id = -1; }
   696       Edge (Invalid) { id = -1; }
   697       bool operator==(const Edge i) const {return id==i.id;}
   697       bool operator==(const Edge i) const {return id==i.id;}
   698       bool operator!=(const Edge i) const {return id!=i.id;}
   698       bool operator!=(const Edge i) const {return id!=i.id;}