lemon/list_graph.h
changeset 785 9ae88e7c04a7
parent 740 819ca5b50de0
parent 739 32baeb8e5c8f
child 786 e20173729589
child 787 c2230649a493
equal deleted inserted replaced
24:0d3ad216186d 25:259b84cdc2f0
   118 
   118 
   119 
   119 
   120     void first(Arc& arc) const {
   120     void first(Arc& arc) const {
   121       int n;
   121       int n;
   122       for(n = first_node;
   122       for(n = first_node;
   123           n!=-1 && nodes[n].first_in == -1;
   123           n != -1 && nodes[n].first_out == -1;
   124           n = nodes[n].next) {}
   124           n = nodes[n].next) {}
   125       arc.id = (n == -1) ? -1 : nodes[n].first_in;
   125       arc.id = (n == -1) ? -1 : nodes[n].first_out;
   126     }
   126     }
   127 
   127 
   128     void next(Arc& arc) const {
   128     void next(Arc& arc) const {
   129       if (arcs[arc.id].next_in != -1) {
   129       if (arcs[arc.id].next_out != -1) {
   130         arc.id = arcs[arc.id].next_in;
   130         arc.id = arcs[arc.id].next_out;
   131       } else {
   131       } else {
   132         int n;
   132         int n;
   133         for(n = nodes[arcs[arc.id].target].next;
   133         for(n = nodes[arcs[arc.id].source].next;
   134             n!=-1 && nodes[n].first_in == -1;
   134             n != -1 && nodes[n].first_out == -1;
   135             n = nodes[n].next) {}
   135             n = nodes[n].next) {}
   136         arc.id = (n == -1) ? -1 : nodes[n].first_in;
   136         arc.id = (n == -1) ? -1 : nodes[n].first_out;
   137       }
   137       }
   138     }
   138     }
   139 
   139 
   140     void firstOut(Arc &e, const Node& v) const {
   140     void firstOut(Arc &e, const Node& v) const {
   141       e.id = nodes[v.id].first_out;
   141       e.id = nodes[v.id].first_out;