Closed ghost closed 1 year ago
If you want graphs with two types of weights, I think you will be better off with packages that support arbitrary metadata, such as MetaGraphsNext.jl
.
As for edge iteration, the edges(g)
iterator yields a sequence of edge objectse
, whose endpoints you can query with src(e)
and dst(e)
Thanks @gdalle So, it is not possible to have a for loop like for (i,j) in edges(g)
, right?
If so, is there any possiblity to query the weight of a certain edge??
The way to do this would be:
for e in edges(g)
i, j, w = src(e), dst(e), weight(e)
end
I'm not sure the weight(e)
function is sufficiently discoverable, do you want to do a small PR that adds it to the code examples in the README?
Thanks so much @gdalle
The documentation was improved a lot by #38, closing this
Hi there!
To create a weighted graph we should issue this command:
g = SimpleWeightedGraph(sources, destinations, weights)
. In addition to distance between edges, I want to asign their time also. That is, having a graph that its weight are both distance and time. I only want to do so, because at some point I need to query the time of some edges, and if I on;y construct the graph based on the distances, I cannot find out the time of a specific edge.So, three questions: 1- Is is possible to have two ways of assigning weights to a graph? 2- Is there any better way? 3- How to iterate ove edges? I did
for (i,j) in edges(g)
and it did not work, which kind of make sense to me, but I don't know how to iterate.Thanks!