networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
generate_edgelist(G, delimiter=' ', data=True)

Parameters

G : NetworkX graph
delimiter : string, optional

Separator for node labels

data : bool or list of keys

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.

Returns

lines : string

Lines of data in adjlist format.

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

See Also

read_adjlist
write_adjlist

Examples

>>> 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"]):
...  print(line) 0 1 0 2 0 3 1 2 3 1 3 2 3 3 4 4 5 5 6
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

networkx.readwrite.edgelist.generate_edgelist

Local connectivity graph

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


GitHub : /networkx/readwrite/edgelist.py#43
type: <class 'function'>
Commit: