According to the NetworkX documentation, the function generate_adjlist()
generates an adjacency list shown below:
>>> G = nx.lollipop_graph(4, 3)
>>> for line in nx.generate_adjlist(G):
... print(line)
0 1 2 3
1 2 3
2 3
3 4
4 5
5 6
6
However, I notice that the adjacency list do not include the nodes that were linked previously. For example, if you look at row three (2 3), it does not include 0 even though at row one (0 1 2 3), 0 links to node 2.
How do I include the previous nodes which were omitted?