# How to read and set selected nodes in hv.Graph?

**URL:** <https://discourse.holoviz.org/t/how-to-read-and-set-selected-nodes-in-hv-graph/3791>\
**Category:** HoloViews\
**Tags:** hvplot\
**Created:** [June 7, 2022, 1:57pm UTC](https://discourse.holoviz.org/t/how-to-read-and-set-selected-nodes-in-hv-graph/3791 "2022-06-07T13:57:40Z")\
**Posts on this page:** 1\
**Page:** 1

<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 7, 2022, 1:57pm UTC](https://discourse.holoviz.org/t/how-to-read-and-set-selected-nodes-in-hv-graph/3791/1 "2022-06-07T13:57:41Z")

</div>

1. Can I read the selected nodes (using “tap” tool) from hv.Graph object?
2. Can I update the list of selected nodes programmatically? At or after initialization.

```auto
# ---- cell #1 ----
import hvplot.networkx as hvnx
import numpy as np
import networkx as nx
import holoviews as hv

np.random.seed(1)
G = nx.bull_graph()
fig = hvnx.draw(G, with_labels=True)

fig

```

 ![image](https://discourse.holoviz.org/uploads/default/original/2X/1/13114a169d6716c8ddf94bd2db4d83428eee38a8.png)

```auto
# ---- cell #2 ----
# (1) Can I read the selected nodes from `fig` that a user tapped?
# * e.g. smth like print(fig.tap_tool.selected) to return [1,4]
# (2) Can I update the list of selected nodes programmatically?
# * e.g. smth like fig.tap_tool.selected = [1,2,4]

```
