def _bidirectional_shortest_path(G, source, target, ignore_nodes=None, ignore_edges=None, weight=None):
 results = _bidirectional_pred_succ(G, source, target, ignore_nodes, ignore_edges)
 (pred, succ, w) = results
 path = []
 while (w is not None):
  path.append(w)
  w = succ[w]
 w = pred[path[0]]
 while (w is not None):
  path.insert(0, w)
  w = pred[w]
 return (len(path), path)

def _bidirectional_shortest_path ( G , source , target , ignore_nodes = None , ignore_edges = None , weight = None ) : results = _bidirectional_pred_succ ( G , source , target , ignore_nodes , ignore_edges ) ( pred , succ , w ) = results path = [ ] while ( w is not None ) : path . append ( w ) w = succ [ w ] w = pred [ path [ 0 ] ] while ( w is not None ) : path . insert ( 0 , w ) w = pred [ w ] return ( len ( path ) , path )
return shortest path between source and target ignoring nodes in the container exclude .