generic_bfs_edges(G, source, neighbors=None, depth_limit=None, sort_neighbors=None)
The breadth-first search begins at :None:None:`source`
and enqueues the neighbors of newly visited nodes specified by the :None:None:`neighbors`
function.
This implementation is from :None:None:`PADS`
, which was in the public domain when it was first accessed in July, 2004. The modifications to allow depth limits are based on the Wikipedia article ":None:None:`Depth-limited-search`
".
<Unimplemented 'target' '.. _PADS: http://www.ics.uci.edu/~eppstein/PADS/BFS.py'>
<Unimplemented 'target' '.. _Depth-limited-search: https://en.wikipedia.org/wiki/Depth-limited_search'>
Starting node for the breadth-first search; this function iterates over only those edges in the component reachable from this node.
A function that takes a newly visited node of the graph as input and returns an iterator (not just a list) of nodes that are neighbors of that node. If not specified, this is just the G.neighbors
method, but in general it can be any function that returns an iterator over some or all of the neighbors of a given node, in any order.
Specify the maximum search depth
A function that takes the list of neighbors of given node as input, and returns an iterator over these neighbors but with custom ordering.
Iterate over edges in a breadth-first search.
Edges in the breadth-first search starting from :None:None:`source`
.
>>> G = nx.path_graph(3)
... print(list(nx.bfs_edges(G, 0))) [(0, 1), (1, 2)]
>>> print(list(nx.bfs_edges(G, source=0, depth_limit=1))) [(0, 1)]See :
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them