vispy.visuals.graphs.layouts.random module

Random Graph Layout

This layout positions the nodes at random

vispy.visuals.graphs.layouts.random.random(adjacency_mat, directed=False, random_state=None)

Place the graph nodes at random places.

Parameters
adjacency_matmatrix or sparse

The graph adjacency matrix

directedbool

Whether the graph is directed. If this is True, is will also generate the vertices for arrows, which can be passed to an ArrowVisual.

random_stateinstance of RandomState | int | None

Random state to use. Can be None to use np.random.

Yields
(node_vertices, line_vertices, arrow_vertices)tuple

Yields the node and line vertices in a tuple. This layout only yields a single time, and has no builtin animation