Hi all,

Is this expected behavior? It was surprising to me. On 0.4.0-dev+1745, 
pulled today, but I had noticed it previously.

julia> using Graphs

# make a graph and add an edge...

julia> g1 = graph([1, 2], Edge{Int}[])
Directed Graph (2 vertices, 0 edges)

julia> add_edge!(g1, 1, 2)
edge [1]: 1 -- 2

julia> edges(g1)
1-element Array{Edge{Int64},1}:
 edge [1]: 1 -- 2

# OK, all is well.
# But how about this graph:

julia> g2 = graph([2, 3], Edge{Int}[])
Directed Graph (2 vertices, 0 edges)

julia> add_edge!(g2, 2, 3)
ERROR: BoundsError()
 in add_edge! at /Users/canjo/.julia/v0.4/Graphs/src/graph.jl:87
 in add_edge! at /Users/canjo/.julia/v0.4/Graphs/src/graph.jl:98

# Despite giving me an error, it did in fact succesfully add the edge:

julia> edges(g2)
1-element Array{Edge{Int64},1}:
 edge [1]: 2 -- 3

What's going on here?

thanks, Richard


Reply via email to