GraphRecipes.jl
GraphRecipes.jl copied to clipboard
Nested vector notation results with `BoundsError` when no edges from node
Referring to notation found here: http://docs.juliaplots.org/latest/graphrecipes/examples/#Multigraphs-1
Examples when error is returned instead expected behaviour:
- draw graph with two nodes and edge going from 1 to 2:
graphplot([[2]])orgraphplot([[2], []]) - draw graph with 3 nodes arrows from two of them point to the third:
graphplot([[2], [], [2]])
Basically the notation seems to only work as long as each node has an edge originating from it.
There were 2 problems in graphs.jl causing this issue:
- "graphplot([[2]])" did not work because of line 559 using "size(g.args[1])[1]" which should be the number of nodes in the graph. So, my suggestion is to change it to "size(adj_mat,1)"
- "[]" in the input to graphplot causes the input type to be of "Any" instead of "Int", hence the function signatures of "get_adjacency_matrix" and "get_source_destiny_weight" did not work. So, my suggestion is to change "...V<:AbstractVector{Int}" into "...V<:AbstractVector{T} where T<:Any".
Still, I noticed that "graphplot([[1]])" still does not work, but graph of 1 node is not of interest anyway. It is still good to handle the case of graph of 1 node.