aryagraph.layout.remove_overlaps#
- aryagraph.layout.remove_overlaps(layout: Layout, sizes: Mapping[Hashable, Any] | Any = None, *, padding: float = 4.0, max_iter: int = 200) Layout[source]#
Move nodes as little as possible so that no two node boxes overlap.
- Parameters:
layout – Any layout; coordinates are taken as they are (same units as sizes).
sizes –
{node: (w, h)}, a single(w, h)for every node, or None (36×36).padding – Extra space between boxes (each box grows by padding).
max_iter – Upper bound on repeated horizontal/vertical rounds (one round always suffices in exact arithmetic; more guard against round-off).
- Returns:
Layout – A new layout (same method, metric flag and meta) whose boxes are pairwise disjoint. Routes of edges touching a moved node are dropped;
meta["overlap_displacement"]is the total distance moved.