# Selection on graph nodes doesn't work?

**URL:** <https://discourse.holoviz.org/t/selection-on-graph-nodes-doesnt-work/3437>\
**Category:** HoloViews\
**Created:** [March 4, 2022, 8:23pm UTC](https://discourse.holoviz.org/t/selection-on-graph-nodes-doesnt-work/3437 "2022-03-04T20:23:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dwr-psandhu](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/dwr-psandhu/32/531_2.png) [@dwr-psandhu](https://discourse.holoviz.org/u/dwr-psandhu)\
**Post date:** [March 4, 2022, 8:23pm UTC](https://discourse.holoviz.org/t/selection-on-graph-nodes-doesnt-work/3437/1 "2022-03-04T20:23:41Z")

</div>

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

```auto
# 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

```auto
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

```auto
simple_graph.edgepaths*simple_graph.nodes

```

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

What gives?

---

<div class="post-metadata">

**Author:** ![dwr-psandhu](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/dwr-psandhu/32/531_2.png) [@dwr-psandhu](https://discourse.holoviz.org/u/dwr-psandhu)\
**Post date:** [March 5, 2022, 4:45pm UTC](https://discourse.holoviz.org/t/selection-on-graph-nodes-doesnt-work/3437/2 "2022-03-05T16:45:58Z")

</div>

A dumb workaround

```auto
simple_graph.nodes.opts(alpha=0)*simple_graph

```

---

<div class="post-metadata">

**Author:** ![mshevelev](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/mshevelev/32/3584_2.png) [@mshevelev](https://discourse.holoviz.org/u/mshevelev)\
**Post date:** [June 6, 2022, 4:29am UTC](https://discourse.holoviz.org/t/selection-on-graph-nodes-doesnt-work/3437/3 "2022-06-06T04:29:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bli](https://discourse.holoviz.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@bli](https://discourse.holoviz.org/u/bli)\
**Post date:** [December 14, 2022, 11:41am UTC](https://discourse.holoviz.org/t/selection-on-graph-nodes-doesnt-work/3437/4 "2022-12-14T11:41:41Z")

</div>

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