I am trying to find the paths between two vertices on a directed graph. I have an igraph object that is the directed graph; I have a parent node, and the list of vertex sequences for the nodes with the attribute which I want. I wish to find the paths in this directed graph from my parent node to these nodes with the attribute.
The only relevant command from igraph seems to be 'all_simple_paths' (if I were to use inbuilt functions for efficiency, rather than writing my own). I would then have to find a way to deal with the directionality issue.
However even as a preliminary approach, I cannot get all_simple_paths to work from igraph!
The error is thus:
Traceback (most recent call last): File "/homes/jlada/Documents/omnipath_folder/full_network/vss.py", line 3, in from igraph import all_simple_paths ImportError: cannot import name 'all_simple_paths' from 'igraph' (/nfs/software/software/Linux_x86_64/opt/stow/anaconda3/envs/pypath/lib/python3.7/site-packages/igraph/init.py)
Note: I have checked that I have the right version of igraph installed, i.e. python-igraph
And I am running the code:
from pypath import main, data_formats
import igraph
from igraph import all_simple_paths
import time
protein = 'BMP7'
max_order= 3
pa = main.PyPath()
pa.init_network(pfile = '/homes/jlada/Documents/omnipath_folder/mynetwork.pickle')
pa.set_transcription_factors()
#network_graph = pa.gs_neighborhood(protein, order = max_order)
sub_bmp7_2 = pa.get_directed(
pa.graph.induced_subgraph(
list(pa.gs_neighborhood(protein, order = max_order).vs()
)
))
vsparent = [v for v in sub_bmp7_2.vs() if v['name']== protein]
#neighboraffects=set(pa.up_affects('BMP7').up())
tfs_ind=[v for v in sub_bmp7_2.vs() if v['tf']]
print(tfs_ind)
j = all_simple_paths(sub_bmp7_2, vsparent, tfs_ind[1], mode= "out")
print(j)
I thought I should check if the function all_simple_paths is in igraph, so have tried:
import pypath
import igraph
import inspect
print(inspect.getmembers(igraph))
The output is very long. Unfrtunately I do not know how to query the output to see if it contains the all_simple_paths. I did go through it manually, and as far as I could tell, there was no function all_simple_paths.
Has anyone had experience with igraph not containing all_simple_paths? Is this down to the version?