Recently I asked the question How to represent graphs with ipython. The answer was exactly what i was looking for, but today i'm looking for a way to show the edge valuation on the final picture.
The edge valuation is added like this :
import networkx as nx
from nxpd import draw # If another library do the same or nearly the same
# output of nxpd and answer to the question, that's
# not an issue
import random
G = nx.Graph()
G.add_nodes_from([1,2])
G.add_edge(1, 2, weight=random.randint(1, 10))
draw(G, show='ipynb')
And the result is here.
I read the help
of nxpd.draw
(didn't see any web documentation), but i didn't find anything.
Is there a way to print the edge value ?
EDIT : also, if there's a way to give a formating function, this could be good. For example :
def edge_formater(graph, edge):
return "My edge %s" % graph.get_edge_value(edge[0], edge[1], "weight")
EDIT2 : If there's another library than nxpd doing nearly the same output, it's not an issue
EDIT3 : has to work with nx.{Graph|DiGraph|MultiGraph|MultiDiGraph}