Selection on graph nodes doesn't work?

Adding a stream.Selection1D doesn’t work on the hv.Graph. It works with the graph.nodes but only if displaying graph.nodes*graph.edgepath

# Declare abstract edges
N = 8
node_indices = np.arange(N, dtype=np.int32)
source = np.zeros(N, dtype=np.int32)
target = node_indices


simple_graph = hv.Graph(((source, target),))
simple_graph

Adding selection1D with source simple_graph doesn’t work so I used source to the simple_graph.nodes

s1d = hv.streams.Selection1D(source=simple_graph.nodes)

def select_index(index):
    print('Selecting index: ',index)

s1d.add_subscriber(select_index)

The above still doesn’t do any callbacks.

However if I display graph nodes overlayed with graph edgepaths it works

simple_graph.edgepaths*simple_graph.nodes

Now the events for selection works but the graph selection features and styling are gone.

What gives?

1 Like

A dumb workaround

simple_graph.nodes.opts(alpha=0)*simple_graph
1 Like

got a similar problem – wondering if there is a solution for it

Same problem here. I’m using a similar workaround with X.edgepaths * X.nodes now.