Expanding on this question, Is it possible to only display values of edge attributes?
For instance, currently using
paragraph = """
John is a computer scientist. John eats mango. John has an elder sister named Mary.
"""
mg.make_graph(paragraph) #This is my custom method, which creates the following graph
nx.draw(mg,pos=graphviz_layout(mg,prog='neato'),arrows=True,with_labels=True,alpha=0.5,linewidths=0.5,scale=2)
nx.draw_networkx_edge_labels(mg, pos = graphviz_layout(mg, prog='neato'),labels = nx.get_edge_attributes(mg,'label'))
plt.show()
However I only want the value of the attribute and not the key itself. (The word 'label' must not be printed.
I understand this is because nx.get_edge_attributes(mg,'label')
returns a dictionary, but using nx.get_edge_attributes(mg,'label').values()
in the labels
parameter, also does not result in the graph being displayed with only values.
How can I achieve this? (i.e, only the value must be printed in edge and not the key label).