Skip to content

@graphty/graphty-element / session / ComponentStatistics

Interface: ComponentStatistics ​

Defined in: graphty-element/src/session/types.ts:444

The connected-component shape of the graph.

sizes is the size distribution rather than only the largest, because without it a consumer has to walk componentOf over every node to answer "are the small parts mostly single nodes?", and that walk is the sort of graph logic that belongs in the element.

Properties ​

count ​

readonly count: number

Defined in: graphty-element/src/session/types.ts:446

How many connected components the graph has, counting isolated nodes as components.


isolatedCount ​

readonly isolatedCount: number

Defined in: graphty-element/src/session/types.ts:452

How many components hold exactly one node.


largestSize ​

readonly largestSize: number

Defined in: graphty-element/src/session/types.ts:450

The size of the largest component; zero for an empty graph.


sizes ​

readonly sizes: readonly number[]

Defined in: graphty-element/src/session/types.ts:448

Component sizes, descending, capped at COMPONENT_SIZE_CAP entries.


truncatedSizes ​

readonly truncatedSizes: boolean

Defined in: graphty-element/src/session/types.ts:454

True when sizes was cut short by the cap, so it is a prefix rather than the whole list.

Methods ​

componentOf() ​

componentOf(id): number | undefined

Defined in: graphty-element/src/session/types.ts:460

Which component a node belongs to.

Parameters ​

id ​

NodeId

the node id

Returns ​

number | undefined

the component number, or undefined when the graph has no such node