lemon/list_graph.h
changeset 739 32baeb8e5c8f
parent 617 4137ef9aacc6
child 741 10c9c3a35b83
equal deleted inserted replaced
19:712c74846880 23:37940b65e1ef
   114 
   114 
   115 
   115 
   116     void first(Arc& arc) const {
   116     void first(Arc& arc) const {
   117       int n;
   117       int n;
   118       for(n = first_node;
   118       for(n = first_node;
   119           n!=-1 && nodes[n].first_in == -1;
   119           n != -1 && nodes[n].first_out == -1;
   120           n = nodes[n].next) {}
   120           n = nodes[n].next) {}
   121       arc.id = (n == -1) ? -1 : nodes[n].first_in;
   121       arc.id = (n == -1) ? -1 : nodes[n].first_out;
   122     }
   122     }
   123 
   123 
   124     void next(Arc& arc) const {
   124     void next(Arc& arc) const {
   125       if (arcs[arc.id].next_in != -1) {
   125       if (arcs[arc.id].next_out != -1) {
   126         arc.id = arcs[arc.id].next_in;
   126         arc.id = arcs[arc.id].next_out;
   127       } else {
   127       } else {
   128         int n;
   128         int n;
   129         for(n = nodes[arcs[arc.id].target].next;
   129         for(n = nodes[arcs[arc.id].source].next;
   130             n!=-1 && nodes[n].first_in == -1;
   130             n != -1 && nodes[n].first_out == -1;
   131             n = nodes[n].next) {}
   131             n = nodes[n].next) {}
   132         arc.id = (n == -1) ? -1 : nodes[n].first_in;
   132         arc.id = (n == -1) ? -1 : nodes[n].first_out;
   133       }
   133       }
   134     }
   134     }
   135 
   135 
   136     void firstOut(Arc &e, const Node& v) const {
   136     void firstOut(Arc &e, const Node& v) const {
   137       e.id = nodes[v.id].first_out;
   137       e.id = nodes[v.id].first_out;