NetworkX

Basic algorithms for depth-first searching.

Based on http://www.ics.uci.edu/~eppstein/PADS/DFS.py by D. Eppstein, July 2004.

dfs_edges(G[, source]) |
Produce edges in a depth-first-search starting at source. |

dfs_tree(G[, source]) |
Return directed tree of depth-first-search from source. |

dfs_predecessors(G[, source]) |
Return dictionary of predecessors in depth-first-search from source. |

dfs_successors(G[, source]) |
Return dictionary of successors in depth-first-search from source. |

dfs_preorder_nodes(G[, source]) |
Produce nodes in a depth-first-search pre-ordering starting at source. |

dfs_postorder_nodes(G[, source]) |
Produce nodes in a depth-first-search post-ordering starting |

dfs_labeled_edges(G[, source]) |
Produce edges in a depth-first-search starting at source and |

Basic algorithms for breadth-first searching.

bfs_edges(G, source) |
Produce edges in a breadth-first-search starting at source. |

bfs_tree(G, source) |
Return directed tree of breadth-first-search from source. |

bfs_predecessors(G, source) |
Return dictionary of predecessors in breadth-first-search from source. |

bfs_successors(G, source) |
Return dictionary of successors in breadth-first-search from source. |