# HG changeset patch
# User Peter Kovacs <kpeter@inf.elte.hu>
# Date 1250599376 7200
# Node ID c6157e490d8c52ec14e1b57c14e0df59d450eccd
# Parent 9f529abcaebf13f19e61ba24fdd2c3631860af91
Modify the implementation of ListDigraph::ArcIt (#309)
The new implementation is based on outarc iteration (like
ListGraph::ArcIt) instead of inarc iteration. It could be
better if the outgoing arcs of the nodes were added to the
graph near to each other, which seems to be a typical case.
diff git a/lemon/list_graph.h b/lemon/list_graph.h
a

b


116  116  void first(Arc& arc) const { 
117  117  int n; 
118  118  for(n = first_node; 
119   n!=1 && nodes[n].first_in == 1; 
 119  n != 1 && nodes[n].first_out == 1; 
120  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  124  void next(Arc& arc) const { 
125   if (arcs[arc.id].next_in != 1) { 
126   arc.id = arcs[arc.id].next_in; 
 125  if (arcs[arc.id].next_out != 1) { 
 126  arc.id = arcs[arc.id].next_out; 
127  127  } else { 
128  128  int n; 
129   for(n = nodes[arcs[arc.id].target].next; 
130   n!=1 && nodes[n].first_in == 1; 
 129  for(n = nodes[arcs[arc.id].source].next; 
 130  n != 1 && nodes[n].first_out == 1; 
131  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  