networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
parse_edgelist(lines, comments='#', delimiter=None, create_using=None, nodetype=None, data=True)

Parameters

lines : list or iterator of strings

Input data in edgelist format

comments : string, optional

Marker for comment lines

delimiter : string, optional

Separator for node labels

create_using: NetworkX graph container, optional :

Use given NetworkX graph for holding nodes or edges.

nodetype : Python type, optional

Convert nodes to this type.

data : bool or list of (label,type) tuples

If False generate no edge data or if True use a dictionary representation of edge data or a list tuples specifying dictionary key names and types for edge data.

Returns

G: NetworkX Graph

The bipartite graph corresponding to lines

Parse lines of an edge list representation of a bipartite graph.

Examples

Edgelist with no data:

>>> from networkx.algorithms import bipartite
... lines = ["1 2", "2 3", "3 4"]
... G = bipartite.parse_edgelist(lines, nodetype=int)
... sorted(G.nodes()) [1, 2, 3, 4]
>>> sorted(G.nodes(data=True))
[(1, {'bipartite': 0}), (2, {'bipartite': 0}), (3, {'bipartite': 0}), (4, {'bipartite': 1})]
>>> sorted(G.edges())
[(1, 2), (2, 3), (3, 4)]

Edgelist with data in Python dictionary representation:

>>> lines = ["1 2 {'weight':3}", "2 3 {'weight':27}", "3 4 {'weight':3.0}"]
... G = bipartite.parse_edgelist(lines, nodetype=int)
... sorted(G.nodes()) [1, 2, 3, 4]
>>> sorted(G.edges(data=True))
[(1, 2, {'weight': 3}), (2, 3, {'weight': 27}), (3, 4, {'weight': 3.0})]

Edgelist with data in a list:

>>> lines = ["1 2 3", "2 3 27", "3 4 3.0"]
... G = bipartite.parse_edgelist(lines, nodetype=int, data=(("weight", float),))
... sorted(G.nodes()) [1, 2, 3, 4]
>>> sorted(G.edges(data=True))
[(1, 2, {'weight': 3.0}), (2, 3, {'weight': 27.0}), (3, 4, {'weight': 3.0})]
See :

Back References

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

networkx.algorithms.bipartite.edgelist.parse_edgelist networkx.algorithms.bipartite.edgelist.read_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/algorithms/bipartite/edgelist.py#149
type: <class 'function'>
Commit: