networkx.readwrite.adjlist.generate_adjlist

generate_adjlist(G, delimiter=' ')[source]

Generate a single line of the graph G in adjacency list format.

Parameters
  • G (NetworkX graph)

  • delimiter (string, optional) – Separator for node labels

Returns

lines – Lines of data in adjlist format.

Return type

string

Examples

>>> 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