Skip to main content
`Ctrl`+`K`

# Traversal

## Depth First Search

Basic algorithms for depth-first searching the nodes of a graph.

`dfs_edges`(G[, source, depth_limit, ...]) | Iterate over edges in a depth-first-search (DFS).
`dfs_tree`(G[, source, depth_limit, ...]) | Returns oriented tree constructed from a depth-first-search from source.
`dfs_predecessors`(G[, source, depth_limit, ...]) | Returns dictionary of predecessors in depth-first-search from source.
`dfs_successors`(G[, source, depth_limit, ...]) | Returns dictionary of successors in depth-first-search from source.
`dfs_preorder_nodes`(G[, source, depth_limit, ...]) | Generate nodes in a depth-first-search pre-ordering starting at source.
`dfs_postorder_nodes`(G[, source, ...]) | Generate nodes in a depth-first-search post-ordering starting at source.
`dfs_labeled_edges`(G[, source, depth_limit, ...]) | Iterate over edges in a depth-first-search (DFS) labeled by type.

## Breadth First Search

Basic algorithms for breadth-first searching the nodes of a graph.

`bfs_edges`(G, source[, reverse, depth_limit, ...]) | Iterate over edges in a breadth-first-search starting at source.
`bfs_layers`(G, sources) | Returns an iterator of all the layers in breadth-first search traversal.
`bfs_tree`(G, source[, reverse, depth_limit, ...]) | Returns an oriented tree constructed from of a breadth-first-search starting at source.
`bfs_predecessors`(G, source[, depth_limit, ...]) | Returns an iterator of predecessors in breadth-first-search from source.
`bfs_successors`(G, source[, depth_limit, ...]) | Returns an iterator of successors in breadth-first-search from source.
`descendants_at_distance`(G, source, distance) | Returns all nodes at a fixed `distance` from `source` in `G`.
`generic_bfs_edges`(G, source[, neighbors, ...]) | Iterate over edges in a breadth-first search.

## Beam search

Basic algorithms for breadth-first searching the nodes of a graph.

`bfs_beam_edges`(G, source, value[, width]) | Iterates over edges in a beam search.

## Depth First Search on Edges

Algorithms for a depth-first traversal of edges in a graph.

`edge_dfs`(G[, source, orientation]) | A directed, depth-first-search of edges in `G`, beginning at `source`.

## Breadth First Search on Edges

Algorithms for a breadth-first traversal of edges in a graph.

`edge_bfs`(G[, source, orientation]) | A directed, breadth-first-search of edges in `G`, beginning at `source`.