# Finding shortest path between vertex groups

**URL:** <https://igraph.discourse.group/t/finding-shortest-path-between-vertex-groups/293>\
**Category:** Usage\
**Tags:** Python\
**Created:** [15 June 2020 09:58 UTC](https://igraph.discourse.group/t/finding-shortest-path-between-vertex-groups/293 "2020-06-15T09:58:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![erelon](https://yyz2.discourse-cdn.com/free1/user_avatar/igraph.discourse.group/erelon/32/271_2.png) [@erelon](https://igraph.discourse.group/u/erelon)\
**Post date:** [15 June 2020 09:58 UTC](https://igraph.discourse.group/t/finding-shortest-path-between-vertex-groups/293/1 "2020-06-15T09:58:12Z")

</div>

I’m using python 2.7 with igraph 0.8

Given some groups of vertexes that I want to find the shortest path between all of the groups.  
(Assuming that there is a path)  
I need only one path between one group to another.

for example:  
group one: start node  
group two: [node\_5, node\_10]  
group three: [node\_6, node\_9]

If the length of: [strat node -\> … -\> node\_5 -\> … -\> node\_9] is the shortest - return it  
If the length of: [strat node -\> … -\> node\_10 -\> … -\> node\_9] is the shortest - return it  
etc.

I have started with a very basic algorithm that searches for the closest vertex to the start point and then recursively searches for the closest vertex from the other groups. It doesn’t return the shortest path (of course).

Is there a ready function or easy way with other function to achieve this in igragh?
