computeCentrality method

Map<String, int> computeCentrality()

Compute centrality scores for nodes.

Higher score = more nodes depend on this node (more central).

Implementation

Map<String, int> computeCentrality() {
  final centrality = <String, int>{};

  for (final nodeId in _nodes.keys) {
    centrality[nodeId] = getDependents(nodeId).length;
  }

  return centrality;
}