Skip to content

eles.degreeCentralityNormalized(options?)

eles.degreeCentralityNormalized — Collection > Algorithms > Centrality. Cytoscape.js signatures, parameters and return contract.

eles.degreeCentralityNormalized — Collection › Algorithms › Centrality

Preview · Collection › Algorithms › Centrality

Read in the complete API reference · All API members

// Compute each node's Opsahl generalized degree and normalize against the maximum in this collection (default) or, under normalization: 'size', against n − 1 — NetworkX's degreecentrality and igraph's normalized = TRUE (a lone node scores 1, as in NetworkX)
eles.degreeCentralityNormalized(options?: DegreeCentralityOptions): DegreeCentralityNormalizedResult

Compute each node's Opsahl generalized degree and normalize against the maximum in this collection (default) or, under normalization: 'size', against n − 1 — NetworkX's degree_centrality and igraph's normalized = TRUE (a lone node scores 1, as in NetworkX). Directed in- and out-degree are normalized independently. Nodes outside the collection's captured subgraph read as zero.

Parameters
NameDescription
options: DegreeCentralityOptions?

{ weight, alpha, directed, normalization }; the shared option type also allows root, which this all-node method ignores. weight(edge) defaults to 1, alpha defaults to 0, directed defaults to false and normalization to 'max'

Fields of options
NameDescription
root: Collection | null?
weight: WeightFn?
directed: boolean?
alpha: number?

0 = count degree, 1 = weight sum (Opsahl's generalized degree)

normalization: 'max' | 'size'?

read by degreeCentralityNormalized only: 'max' (default) divides by the largest degree, 'size' by n − 1 — NetworkX's degree_centrality and igraph's normalized = TRUE

Returns DegreeCentralityNormalizedResult

a degree(node) accessor, or indegree(node) and outdegree(node) accessors when directed. Each divides by its corresponding maximum or by n − 1; under 'max' results are in [0, 1] when weights and alpha produce nonnegative finite degrees. These numeric constraints are not validated.

Example

const result = eles.degreeCentralityNormalized();
console.log(result.degree(cy.getElementById('b'))); // 1

Example graph and handle setup

Throws

if normalization is neither 'max' nor 'size'

Also spelled eles.dcn, eles.degreeCentralityNormalised.