aryagraph.layout.compute#
- aryagraph.layout.compute(g: Any, method: str | Layout | Mapping[Hashable, Any] | Callable[[...], Any] = 'auto', *, seed: int = 0, sizes: Mapping[Hashable, Any] | None = None, components: str | None = 'pack', **kwargs: Any) Layout[source]#
Compute a layout by name (the entry point used by
aryagraph.draw()).- Parameters:
method – A name (see
METHODS;"auto"picks viaauto_method()), aLayoutor{node: (x, y)}mapping (validated and returned in graph order), or a callablef(g, **kwargs)returning either.seed – Forwarded to the engine (every engine is deterministic per seed).
sizes –
{node: (w, h)}node boxes in pixels; forwarded to size-aware engines (hierarchical, tree, radial, forceatlas2) and ignored by others.components –
"pack"(default): stress, force, forceatlas2 and spectral lay out each weakly connected component separately and pack the pieces with a gap of one typical edge length.Nonelays out the whole graph at once with the force-directed engines; stress and spectral need connected input, so they pack components in either case.**kwargs – Engine options. With
"auto", options the chosen engine does not accept are ignored (so e.g.orientationis harmless for a cyclic graph).
- Raises:
ValueError – For an unknown method name (the message lists the valid ones).