networkx 2.8.2 Pypi GitHub Homepage
Other Docs
ParametersReturnsBackRef
random_layout(G, center=None, dim=2, seed=None)

For every node, a position is generated by choosing each of dim coordinates uniformly at random on the interval [0.0, 1.0).

NumPy (http://scipy.org) is required for this function.

Parameters

G : NetworkX graph or list of nodes

A position will be assigned to every node in G.

center : array-like or None

Coordinate pair around which to center the layout.

dim : int

Dimension of layout.

seed : int, RandomState instance or None optional (default=None)

Set the random state for deterministic node layouts. If int, :None:None:`seed` is the seed used by the random number generator, if numpy.random.RandomState instance, :None:None:`seed` is the random number generator, if None, the random number generator is the RandomState instance used by numpy.random.

Returns

pos : dict

A dictionary of positions keyed by node

Position nodes uniformly at random in the unit square.

Examples

>>> G = nx.lollipop_graph(4, 3)
... pos = nx.random_layout(G)
See :

Back References

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

networkx.drawing.layout.random_layout networkx.drawing.nx_pylab.draw_random

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/drawing/layout.py#59
type: <class 'function'>
Commit: