nimnet/algorithms/wiener

Search:
Group by:

Wiener index and related distance-sum graph indices.

Procs

proc hyperWienerIndex[N](g: Graph[N]): float
Compute the hyper-Wiener index: WW = (1/2) * sum(d + d^2) for all pairs.
proc wienerIndex[N](g: Graph[N]): int
Return the Wiener index — the sum of shortest-path distances over all unordered pairs of nodes. Returns 0 for graphs with fewer than 2 nodes.