StressLayout<V> class
final
Positions vertices using Stress Majorization (SMACOF) on graph-theoretic shortest path distances.
Iteratively minimizes the difference between graph-theoretic distances and Euclidean distances. Produces organic, aesthetic layouts and handles disconnected components automatically.
final graph = Graph<String, void>.undirected()
..addEdge('A', 'B')
..addEdge('B', 'C')
..addEdge('C', 'A');
final result = graph.layout(const StressLayout());
print(result.positions['A']);
- Inheritance
-
- Object
- GraphLayout<
V> - StressLayout
Constructors
- StressLayout({int iterations = 100, double tolerance = 1e-4, double vertexDistance = 50.0, LayoutPoint center = const LayoutPoint(0, 0), int seed = 42})
-
Constructs a stress majorization layout strategy.
const
Properties
- center → LayoutPoint
-
Center coordinate of the resulting layout.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- iterations → int
-
Maximum number of SMACOF majorization iterations.
final
- packDisconnectedComponents → bool
-
Whether this layout strategy decomposes disconnected components and packs them.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- seed → int
-
Pseudo-random seed used for initial placement fallback.
final
- tolerance → double
-
Convergence threshold on maximum vertex displacement per iteration.
final
- vertexDistance → double
-
Target average Euclidean length for graph edges.
final
Methods
-
layout(
LayoutInput< V> input) → LayoutResult<V> -
Computes vertex positions and optional edge routes for
input.inherited -
layoutComponent(
LayoutInput< V> input) → LayoutResult<V> - Internal layout implementation for a single connected component.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited