OldGraphs.jl icon indicating copy to clipboard operation
OldGraphs.jl copied to clipboard

test_cyclic_by_dfs throws a BoundsError

Open nikagra opened this issue 8 years ago • 0 comments

BoundsError can be thrown during processing of test_cyclic_by_dfs if ids of edges are not in order. The error is thrown in Graphs/src/depth_first_visit.jl:28 which is:

e_color = edgecolormap[edge_index(v_edge, graph)]

In other words edgecolormap is indexed with ids of edges assuming that if there are n edges, than their ids are in {1,...,n} which is not always the case (we can assemble graph manually or remove some edges) Example:

v = [1,2,3,4,5,6,7]
e = [edge [1]: 1 -- 2,edge [3]: 3 -- 4,edge [4]: 1 -- 4,edge [8]: 5 -- 6,edge [9]: 5 -- 7,edge [11]: 1 -- 6]
ERROR: BoundsError: attempt to access 6-element Array{Int64,1}:
 1
 0
 0
 1
 0
 0
  at index [11]
 in depth_first_visit_impl! at /home/user/.julia/v0.4/Graphs/src/depth_first_visit.jl:28

nikagra avatar Apr 22 '16 16:04 nikagra