Skip to content

@graphty/graphty-element / session / LayoutRecommendationOptions

Interface: LayoutRecommendationOptions ​

Defined in: graphty-element/src/session/layout.ts:45

What recommendLayout may be told beyond the graph's shape.

Properties ​

largeGraphThreshold? ​

readonly optional largeGraphThreshold?: number

Defined in: graphty-element/src/session/layout.ts:68

The node count above which this graph counts as large.

Defaults to the element's own shipped DEFAULT_LIMITS.largeGraphThreshold. Pass the value from capabilities.limits once something has measured the machine, so the recommendation moves with the host rather than with a constant.


placedNodes? ​

readonly optional placedNodes?: number

Defined in: graphty-element/src/session/layout.ts:60

How many nodes THE DATA arrived carrying a coordinate for, from session.seededNodeCount.

NOT positions.placedCount, and the difference decides this whole recommendation. The position array is written by the importer AND by every running layout, so one animation frame after a file with no coordinates finishes loading, every node carries a position -- the layout put it there. Reading that number here answers "keep the arrangement the data arrived with" for a file that arrived with none, and pins the graph to whatever the first step of a force layout reached.

Given and equal to the node count, the data placed every node and the arrangement that keeps those coordinates wins: recomputing would throw away an arrangement somebody authored. Omitted, the rule assumes nothing is placed, which is what an unseeded graph looks like.