Hvplot.networkx: Show node and edge attributes on hover

Hi everyone,

I managed to get the toolbar to show the node attributes, but am not getting any idea how to show the edge attribute on hovering an edge in the graph.

Here is a minimal example:

import networkx as nx
import hvplot.networkx as hvnx

g = nx.petersen_graph()
for n in g.nodes():
    if n < 5:
        g.nodes[n]["Country"] = "US"
    else:
        g.nodes[n]["Country"] = "DE"
for e in g.edges():
    g.edges[e]["Relation"] = "Good"

spring = hvnx.draw(g, with_labels=True)
# in a notebook
spring

Currently, I do see the node attributes. How can we also render the edge attributes? I saw a bokeh example, but could not translate it to hvplot.

Thanks in advance,

Sam

1 Like

Try:

spring = hvnx.draw(g, with_labels=True, inspection_policy = 'edges')

Thanks James @jbednar

What if we would like both edges and nodes? With the inspection policy attribute, I can only have either.

Regards,
Sam

1 Like

I’m not sure if that’s possible; I think that’s a Bokeh question.

It would be nice to have this functionality.