NetworkX

Previous topic

networkx.LabeledDiGraph.predecessors_iter

Next topic

networkx.LabeledDiGraph.adjacency_iter

Quick search

networkx.LabeledDiGraph.adjacency_list

LabeledDiGraph.adjacency_list()

Return an adjacency list as a Python list of lists

The output adjacency list is in the order of G.nodes(). For directed graphs, only outgoing adjacencies are included.

Examples

>>> G=nx.path_graph(4)
>>> G.adjacency_list() # in sorted node order 0,1,2,3
[[1], [0, 2], [1, 3], [2]]