def all_simple_paths(G, source, target, cutoff=None):
 if (source not in G):
  raise nx.NodeNotFound(('source node %s not in graph' % source))
 if (target not in G):
  raise nx.NodeNotFound(('target node %s not in graph' % target))
 if (cutoff is None):
  cutoff = (len(G) - 1)
 if G.is_multigraph():
  return _all_simple_paths_multigraph(G, source, target, cutoff=cutoff)
 else:
  return _all_simple_paths_graph(G, source, target, cutoff=cutoff)

def all_simple_paths ( G , source , target , cutoff = None ) : if ( source not in G ) : raise nx . NodeNotFound ( ( 'source node %s not in graph' % source ) ) if ( target not in G ) : raise nx . NodeNotFound ( ( 'target node %s not in graph' % target ) ) if ( cutoff is None ) : cutoff = ( len ( G ) - 1 ) if G . is_multigraph ( ) : return _all_simple_paths_multigraph ( G , source , target , cutoff = cutoff ) else : return _all_simple_paths_graph ( G , source , target , cutoff = cutoff )
generate all simple paths in the graph g from source to target .