From a8c779ff797ccaa5582ff1cd50983ef06be86a79 Mon Sep 17 00:00:00 2001 From: Seth Bromberger Date: Mon, 29 Jun 2015 10:36:16 -0500 Subject: [PATCH 1/3] Update connected_components.jl This fixes the bug in #187. It seems appropriate to check for `w_color > 0` instead of `==1` since it shouldn't matter here that the vertex hasn't been explored. We're doing a dfs for each vertex whose colormap !=0 in any case. --- src/connected_components.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connected_components.jl b/src/connected_components.jl index 1d96e574..6d5f29a5 100644 --- a/src/connected_components.jl +++ b/src/connected_components.jl @@ -109,7 +109,7 @@ function discover_vertex!(vis::TarjanVisitor, v) end function examine_neighbor!(vis::TarjanVisitor, v, w, w_color::Int, e_color::Int) - if w_color == 1 # 1 means added seen, but not explored + if w_color > 0 # if we've seen this vertex already while vis.index[vertex_index(w, vis.graph)] < vis.lowlink[end] pop!(vis.lowlink) end From 7d991787c65c330e8e6c9a2211a7518f5086e716 Mon Sep 17 00:00:00 2001 From: Seth Bromberger Date: Mon, 29 Jun 2015 11:26:22 -0500 Subject: [PATCH 2/3] Update connected_components.jl --- src/connected_components.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/connected_components.jl b/src/connected_components.jl index 6d5f29a5..789ae3a7 100644 --- a/src/connected_components.jl +++ b/src/connected_components.jl @@ -110,7 +110,8 @@ end function examine_neighbor!(vis::TarjanVisitor, v, w, w_color::Int, e_color::Int) if w_color > 0 # if we've seen this vertex already - while vis.index[vertex_index(w, vis.graph)] < vis.lowlink[end] + vi = vis.index[vertex-index(w, vis.graph)] + while vi > 0 && vi < vis.lowlink[end] pop!(vis.lowlink) end end From 7b8fe13d1c063d10e1ba48dd5493307a2d7e19aa Mon Sep 17 00:00:00 2001 From: Seth Bromberger Date: Mon, 29 Jun 2015 11:26:58 -0500 Subject: [PATCH 3/3] Update connected_components.jl --- src/connected_components.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/connected_components.jl b/src/connected_components.jl index 789ae3a7..3b5bb731 100644 --- a/src/connected_components.jl +++ b/src/connected_components.jl @@ -110,7 +110,7 @@ end function examine_neighbor!(vis::TarjanVisitor, v, w, w_color::Int, e_color::Int) if w_color > 0 # if we've seen this vertex already - vi = vis.index[vertex-index(w, vis.graph)] + vi = vis.index[vertex_index(w, vis.graph)] while vi > 0 && vi < vis.lowlink[end] pop!(vis.lowlink) end