You can use the edges()
method to get all edges in the directed graph and then use the get()
method on the edge to get the weight of each edge.
Here's an example:
main.py304 chars14 lines
This will output:
main.py66 chars4 lines
You can modify the print()
statement to store the weights in a list or dictionary if needed.
gistlibby LogSnag