documentationfor yFiles for HTML 3.0.0.3

DegreeCentrality

Computes the degree centrality for the nodes of a given graph.

Inheritance Hierarchy
DegreeCentrality

Remarks

Degree centrality is the number of the incoming, outgoing, or overall edges incident to a node (measures incoming, outgoing, and overall degree).

If both considerIncomingEdges and considerOutgoingEdges are false, an InvalidOperationError is thrown.

Other Centrality Measures

@PRODUCT@ supports a number of other centrality measures:

Examples

const result = new DegreeCentrality().run(graph)

// add node labels for centrality values
// and adjust node size according to centrality
result.normalizedNodeCentrality.forEach((entry) => {
  const node = entry.key
  const centrality = entry.value
  graph.addLabel(node, `${centrality}`)
  graph.setNodeLayout(
    node,
    new Rect(node.layout.center, new Size(centrality, centrality)),
  )
})

Type Details

yFiles module
view-layout-bridge

See Also

Constructors

Properties

Methods