-
Notifications
You must be signed in to change notification settings - Fork 81
parents of source vertices #150
Comments
I don't think we should change the |
I have no strong opinion on this, we just need to pick a convention and document it well. |
As far as documentation goes, we should be explicit that |
The tests I took from @sbromberger were not exhaustive in covering graphs where the nodes are not their own indices, and so the implementation of julia> g = Graphs.inclist([4,5,6,7],is_directed=true)
julia> Graphs.add_edge!(g, 4,6)
julia> Graphs.add_edge!(g, 5,7)
julia> Graphs.add_edge!(g, 6,7)
julia> sps = dijkstra_shortest_paths(g,4)
julia> enumerate_paths(sps)
ERROR: BoundsError()
in enumerate_paths at /Users/yeesian/.julia/v0.3/Graphs/src/dijkstra_spath.jl:269
in enumerate_paths at /Users/yeesian/.julia/v0.3/Graphs/src/dijkstra_spath.jl:279 The error can be traced down to the fact that the julia> sps.hasparent
4-element Array{Bool,1}:
false
false
true
true
julia> sps.parents
4-element Array{Int64,1}:
4
0
4
6 As it currently stands, I'm unable to use Remark: this might be a breaking change, for people whose code relied on the previous behavior (in cc @pozorvlak |
We're not talking about changing If not, can't we just call |
After revisiting the thread in #16, I think @sbromberger's suggestion is a reasonable workaround, since there seems to be a general philosophy of iterating over vertices in this package, rather than working with indices. In that case, we'll need to access the graph in |
On the other hand, having parents be indices means we can use 0 to denote source / no parent, which means we can retire hasparent. It's worth further consideration. |
I'll replace |
That's fine by me as long as we preserve the behavior of |
see discussion in JuliaAttic#150
Following a discussion:
Should they be left as
#undef
, rather than pointing back to themselves?The text was updated successfully, but these errors were encountered: