This is something related to the vertex indexing mechanism. Please file an
issue on Graphs.jl. We may discuss how to solve this over there.
Dahua
On Saturday, November 22, 2014 6:39:47 AM UTC+8, Richard Futrell wrote:
>
> 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
>
>
>