[Lemon-commits] Peter Kovacs: Modify the implementation of ListD...

Lemon HG hg at lemon.cs.elte.hu
Wed Sep 30 08:52:47 CEST 2009


details:   http://lemon.cs.elte.hu/hg/lemon/rev/32baeb8e5c8f
changeset: 790:32baeb8e5c8f
user:      Peter Kovacs <kpeter [at] inf.elte.hu>
date:      Mon Sep 28 12:48:44 2009 +0200
description:
	Modify the implementation of ListDigraph::ArcIt (#311)

	The new implementation is based on out-arc iteration (like
	ListGraph::ArcIt) instead of in-arc iteration to make it consistent
	with the documentation.

diffstat:

 lemon/list_graph.h |  14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diffs (31 lines):

diff --git a/lemon/list_graph.h b/lemon/list_graph.h
--- a/lemon/list_graph.h
+++ b/lemon/list_graph.h
@@ -116,20 +116,20 @@
     void first(Arc& arc) const {
       int n;
       for(n = first_node;
-          n!=-1 && nodes[n].first_in == -1;
+          n != -1 && nodes[n].first_out == -1;
           n = nodes[n].next) {}
-      arc.id = (n == -1) ? -1 : nodes[n].first_in;
+      arc.id = (n == -1) ? -1 : nodes[n].first_out;
     }
 
     void next(Arc& arc) const {
-      if (arcs[arc.id].next_in != -1) {
-        arc.id = arcs[arc.id].next_in;
+      if (arcs[arc.id].next_out != -1) {
+        arc.id = arcs[arc.id].next_out;
       } else {
         int n;
-        for(n = nodes[arcs[arc.id].target].next;
-            n!=-1 && nodes[n].first_in == -1;
+        for(n = nodes[arcs[arc.id].source].next;
+            n != -1 && nodes[n].first_out == -1;
             n = nodes[n].next) {}
-        arc.id = (n == -1) ? -1 : nodes[n].first_in;
+        arc.id = (n == -1) ? -1 : nodes[n].first_out;
       }
     }
 



More information about the Lemon-commits mailing list