generate_edgelist(G, delimiter=' ', data=True)
Separator for node labels
If False generate no edge data. If True use a dictionary representation of edge data. If a list of keys use a list of data values corresponding to the keys.
Lines of data in adjlist format.
Generate a single line of the graph G in edge list format.
>>> G = nx.lollipop_graph(4, 3)
... G[1][2]["weight"] = 3
... G[3][4]["capacity"] = 12
... for line in nx.generate_edgelist(G, data=False):
... print(line) 0 1 0 2 0 3 1 2 1 3 2 3 3 4 4 5 5 6
>>> for line in nx.generate_edgelist(G):
... print(line) 0 1 {} 0 2 {} 0 3 {} 1 2 {'weight': 3} 1 3 {} 2 3 {} 3 4 {'capacity': 12} 4 5 {} 5 6 {}
>>> for line in nx.generate_edgelist(G, data=["weight"]):See :
... print(line) 0 1 0 2 0 3 1 2 3 1 3 2 3 3 4 4 5 5 6
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.readwrite.edgelist.generate_edgelist
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