networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersRaisesReturnsBackRef
sets(G, top_nodes=None)

Raises an exception if the graph is not bipartite or if the input graph is disconnected and thus more than one valid solution exists. See bipartite documentation <networkx.algorithms.bipartite> for further details on how bipartite graphs are handled in NetworkX.

Parameters

G : NetworkX graph
top_nodes : container, optional

Container with all nodes in one bipartite node set. If not supplied it will be computed. But if more than one solution exists an exception will be raised.

Raises

AmbiguousSolution

Raised if the input bipartite graph is disconnected and no container with all nodes in one bipartite set is provided. When determining the nodes in each bipartite set more than one valid solution is possible if the input graph is disconnected.

NetworkXError

Raised if the input graph is not bipartite.

Returns

X : set

Nodes from one side of the bipartite graph.

Y : set

Nodes from the other side.

Returns bipartite node sets of graph G.

See Also

color

Examples

>>> from networkx.algorithms import bipartite
... G = nx.path_graph(4)
... X, Y = bipartite.sets(G)
... list(X) [0, 2]
>>> list(Y)
[1, 3]
See :

Back References

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

networkx.algorithms.bipartite.projection.collaboration_weighted_projected_graph networkx.algorithms.bipartite.projection.overlap_weighted_projected_graph networkx.algorithms.bipartite.projection.generic_weighted_projected_graph networkx.drawing.layout.bipartite_layout networkx.algorithms.bipartite.projection.projected_graph networkx.algorithms.bipartite.cluster.average_clustering networkx.algorithms.bipartite.centrality.closeness_centrality networkx.algorithms.bipartite.basic.sets networkx.algorithms.bipartite.projection.weighted_projected_graph networkx.algorithms.bipartite.centrality.betweenness_centrality networkx.algorithms.bipartite.centrality.degree_centrality

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/basic.py#154
type: <class 'function'>
Commit: