Skip to content

@graphty/algorithms / index / triangleCount

Function: triangleCount() ​

triangleCount(s): TriangleCountResult

Defined in: indexed/triangles.ts:139

Triangle counting, with each node's clustering coefficient and the graph's transitivity, over the simple undirected graph underlying the snapshot: arc directions are ignored, parallel edges count once and self-loops not at all, so a directed snapshot and its undirected twin give the same answer. Each edge is oriented from the lower to the higher node in (degree, index) order and the two oriented rows of every oriented edge are intersected, so each triangle is found exactly once: O(m^1.5).

Parameters ​

s ​

GraphSnapshot

Any snapshot

Returns ​

TriangleCountResult

The per-node and total triangles, the clustering coefficient and the transitivity