Skip to main content
`Ctrl`+`K`

# bfs_layout

bfs_layout(G, start, *, align='vertical', scale=1, center=None)

  Position nodes according to breadth-first search algorithm.

  Parameters:
    G NetworkX graph

      A position will be assigned to every node in G.

    start node in `G`

      Starting node for bfs

    center array-like or None

      Coordinate pair around which to center the layout.

  Returns:
    pos dict

      A dictionary of positions keyed by node.

  Notes

  This algorithm currently only works in two dimensions and does not try to minimize edge crossings.

  Examples

      >>> G = nx.path_graph(4)
      >>> pos = nx.bfs_layout(G, 0)