fnss.topologies.topology.Topology.adjacency_iter¶
-
Topology.
adjacency_iter
()¶ Return an iterator of (node, adjacency dict) tuples for all nodes.
This is the fastest way to look at every edge. For directed graphs, only outgoing adjacencies are included.
Returns: adj_iter : iterator
An iterator of (node, adjacency dictionary) for all nodes in the graph.
See also
Examples
>>> G = nx.Graph() # or DiGraph, MultiGraph, MultiDiGraph, etc >>> G.add_path([0,1,2,3]) >>> [(n,nbrdict) for n,nbrdict in G.adjacency_iter()] [(0, {1: {}}), (1, {0: {}, 2: {}}), (2, {1: {}, 3: {}}), (3, {2: {}})]