# get\_shortest\_paths based on vertex

**URL:** <https://igraph.discourse.group/t/get-shortest-paths-based-on-vertex/1021>\
**Category:** Usage\
**Tags:** Python\
**Created:** [29 November 2021 04:24 UTC](https://igraph.discourse.group/t/get-shortest-paths-based-on-vertex/1021 "2021-11-29T04:24:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![CongjianL](https://avatars.discourse-cdn.com/v4/letter/c/e79b87/32.png) [@CongjianL](https://igraph.discourse.group/u/CongjianL)\
**Post date:** [29 November 2021 04:24 UTC](https://igraph.discourse.group/t/get-shortest-paths-based-on-vertex/1021/1 "2021-11-29T04:24:00Z")

</div>

I’m trying to use function get\_shortest\_path to get the shortest path from one node to another. However, some error raised. I can’t understand what’s means.  
That my code:  
“shortest\_path = node1.get\_shortest\_paths(node2)”  
The error messages were following:  
“RuntimeWarning: Couldn’t reach some vertices at src/paths/unweight”

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [29 November 2021 09:02 UTC](https://igraph.discourse.group/t/get-shortest-paths-based-on-vertex/1021/2 "2021-11-29T09:02:24Z")

</div>

It means that there is no path from `node1` to `node2`. Your graph is not (strongly) connected.

---

<div class="post-metadata">

**Author:** ![CongjianL](https://avatars.discourse-cdn.com/v4/letter/c/e79b87/32.png) [@CongjianL](https://igraph.discourse.group/u/CongjianL)\
**Post date:** [29 November 2021 11:31 UTC](https://igraph.discourse.group/t/get-shortest-paths-based-on-vertex/1021/3 "2021-11-29T11:31:08Z")

</div>

Thanks for your answers. But I want to know what’ different between the raising that Error and returning an empty list.

---

<div class="post-metadata">

**Author:** ![szhorvat](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/szhorvat/32/3_2.png) [@szhorvat](https://igraph.discourse.group/u/szhorvat)\
**Post date:** [29 November 2021 11:58 UTC](https://igraph.discourse.group/t/get-shortest-paths-based-on-vertex/1021/4 "2021-11-29T11:58:01Z")

</div>

Note that it is not an error, it is a warning.

If you request the path in terms of edge IDs (see `output` argument), then the path from a vertex to itself is also represented as an empty list. This is the only case I can think of when an empty list would be returned, even though the target vertex is reachable from the source vertex.
