I have an undirected graph like:
import igraph as ig
G = ig.Graph()
G.add_vertices(9)
G.add_edges([(0,1), (1,2),(2,3),(3,0),(0,4),(4,5),(5,6),(6,7),(6,8)])
There is a "loop path" from node 0 via 1,2,3 back to 0 (sorry, in the pic the nodelabels are starting with 1 instead of 0)
For an assignment, I need to identify the node where the "loop path" is connected to the rest of the graph, i.e. 0
, and most importantly, the "loop path" itself, i.e. [0,1,2,3,0]
and/or [0,3,2,1,0]
I am trying hard, but really have no clue. If I use the function from here like find_all_paths(G,0,0)
I of course get only [0]
OK, this is part one of the answer to my own question:
Thanks to Max Li's and deeenes' help, ihad the idea to rewrite the networkx cycle_basis function to work in python_igraph: