MethodError: no method matching SimpleWeightedGraph(::Vector{Int64}, ::Vector{Int64}, ::typeof(weights))
coloedrainbow opened this issue · 2 comments
I've tried to create a samll graph and was wondering why it does not allow me to assign a weight parameter??
sources = rand(1:6, 10)
destinations = rand( 1:6, 10)
weights = 0.2.*rand(1:6, 10)
g = SimpleWeightedGraph(sources, destinations, weights)
Let's assume I could create a weighted graph, I've read the documentation and didn't find any command to be able to find the distance (or time--if it weighted based on time) between two nodes. Do you aware of any?
Thanks a lot for the package!
As for your first question (the bug), the code you posted works fine on my computer. Can you try it again in a fresh Julia session? It looks like weights
is a function and no longer a vector when you run the last line.
As for your second question, SimpleWeightedGraphs.jl only provides a graph format. If you are looking for graph algorithms, you should check out Graphs.jl. Of course, since we live in a beautiful world, the graph format specified here is compatible with all of the algorithms implemented there.
Closing this, feel free to reopen if you have more problems @coloedrainbow