UltipaDocs
Try Playground
  • Introduction
  • Managing HDC Graphs
  • Managing Distributed Projections
  • Installing Algorithms
  • Running Algorithms
    • Degree Centrality
    • Closeness Centrality
    • Harmonic Centrality
    • Graph Centrality
    • Betweenness Centrality
    • Eigenvector Centrality
    • Katz Centrality
    • CELF
    • PageRank
    • ArticleRank
    • TextRank
    • HITS
    • SybilRank
    • Jaccard Similarity
    • Overlap Similarity
    • Cosine Similarity
    • Pearson Correlation Coefficient
    • Euclidean Distance
    • K-Hop All
    • Bipartite Graph
    • HyperANF
    • Connected Component
    • Triangle Counting
    • Induced Subgraph
    • k-Core
    • k-Truss
    • p-Cohesion
    • k-Edge Connected Components
    • Local Clustering Coefficient
    • Topological Sort
    • Schema Overview
    • Dijkstra's Single-Source Shortest Path
    • Delta-Stepping Single-Source Shortest Path
    • Shortest Path Faster Algorithm (SPFA)
    • Minimum Spanning Tree
    • Breadth-First Search (BFS)
    • Depth-First Search (DFS)
    • Adamic-Adar Index
    • Common Neighbors
    • Preferential Attachment
    • Resource Allocation
    • Total Neighbors
    • Louvain
    • Leiden
    • Label Propagation
    • HANP
    • k-Means
    • kNN (k-Nearest Neighbors)
    • K-1 Coloring
    • Conductance
      • Random Walk
      • Node2Vec Walk
      • Node2Vec
      • Struc2Vec Walk
      • Struc2Vec
      • LINE
      • Fast Random Projection
      • Summary of Graph Embedding
      • Gradient Descent
      • Backpropagation
      • Skip-gram
      • Skip-gram Optimization
  1. Docs
  2. /
  3. Graph Analytics & Algorithms
  4. /
  5. Centrality

Katz Centrality

HDC

Overview

Katz Centrality measures the influence of a node by considering not only its immediate connections but also its indirect connections at various distances while diminishing importance to more distant nodes.

Katz centrality values range from 0 to 1, with higher scores indicating nodes that exert greater influence over the flow and connectivity of the network.

References:

  • L. Katz, A New Status Index Derived from Sociometric Analysis (1953)

Concepts

Katz Centrality

The Katz centrality is an extension of the eigenvector centrality. In the k-th round of influence propagation in eigenvector centrality, the centrality vector is simply updated as c(k) = Ac(k-1), where A is the adjacency matrix. Katz centrality modifies this computation by introducing two additional parameters, leading to the following update formula (which should be rescaled afterward):

where,

  • α (alpha) is an attenuation factor that controls how influence decays during each propagation round. In the k-th round, the influences from indirect neighbors that are k steps away are considered, with their contributions cumulatively attenuated by a factor of αk. To ensure the convergence of c(k), α must be smaller than 1/λmax, where λmax is the dominant eigenvalue of the adjacency matrix A.
  • β (beta) is a baseline centrality constant that ensures each node has a nonzero centrality score, even when it receives no influence. The common choice for β is 1.
  • 1 is an n × 1 column vector of ones, where n is the number of nodes in the graph.

Example Graph

Run the following statements on an empty graph to define its structure and insert data:

ALTER GRAPH CURRENT_GRAPH ADD NODE {
  web ()
};
ALTER GRAPH CURRENT_GRAPH ADD EDGE {
  link ()-[{value float}]->()
};
INSERT (web1:web {_id: "web1"}),
       (web2:web {_id: "web2"}),
       (web3:web {_id: "web3"}),
       (web4:web {_id: "web4"}),
       (web5:web {_id: "web5"}),
       (web6:web {_id: "web6"}),
       (web7:web {_id: "web7"}),
       (web1)-[:link {value: 2}]->(web1),
       (web1)-[:link {value: 1}]->(web2),
       (web2)-[:link {value: 0.8}]->(web3),
       (web3)-[:link {value: 0.5}]->(web1),
       (web3)-[:link {value: 1.1}]->(web2),
       (web3)-[:link {value: 1.2}]->(web4),
       (web3)-[:link {value: 0.5}]->(web5),
       (web5)-[:link {value: 0.5}]->(web3),
       (web6)-[:link {value: 2}]->(web6);

Creating HDC Graph

To load the entire graph to the HDC server hdc-server-1 as my_hdc_graph:

CREATE HDC GRAPH my_hdc_graph ON "hdc-server-1" OPTIONS {
  nodes: {"*": ["*"]},
  edges: {"*": ["*"]},
  direction: "undirected",
  load_id: true,
  update: "static"
}

Parameters

Algorithm name: katz_centrality

Name
Type
Spec
Default
Optional
Description
max_loop_numInteger≥120YesThe maximum number of iteration rounds. The algorithm terminates after all iterations are completed.
toleranceFloat(0,1)0.001YesThe algorithm terminates when the changes in all scores between iterations are less than the specified tolerance, indicating that the result is stable.
edge_weight_property"<@schema.?><property>"//YesA numeric edge property used as weights in the adjacency matrix A; edges without this property are ignored.
directionStringin, out/YesConstructs the adjacency matrix A with the in-links (in) or out-links (out) of each node.
alphaFloat(0, 1/λmax)0.25YesThe attenuation factor, which must be less than the inverse of dominant eigenvalue (λmax) of the adjacency matrix A.
betaFloat>01YesThe baseline centrality constant that ensures every node has a nonzero centrality score.
return_id_uuidStringuuid, id, bothuuidYesIncludes _uuid, _id, or both to represent nodes in the results.
limitInteger≥-1-1YesLimits the number of results returned; -1 includes all results.
orderStringasc, desc/YesSorts the results by katz_centrality.

File Writeback

algo(katz_centrality).params({
  projection: "my_hdc_graph",
  return_id_uuid: "id",
  max_loop_num: 50,
  tolerance: 0.00001,
  direction: "in",
  alpha: 0.4
}).write({
  file: {
    filename: "katz_centrality"
  }
})

Result:

File: katz_centrality
_id,katz_centrality
web3,0.458447
web7,0.127183
web1,0.517601
web5,0.310561
web6,0.211972
web2,0.517601
web4,0.310561

DB Writeback

Writes the katz_centrality values from the results to the specified node property. The property type is double.

algo(katz_centrality).params({
  projection: "my_hdc_graph",
  edge_weight_property: "@link.value"
}).write({
  db:{ 
    property: 'kc'
  }
})

Full Return

exec{
  algo(katz_centrality).params({
    return_id_uuid: "id",    
    max_loop_num: 100,
    tolerance: 0.00001,
    edge_weight_property: "value",
    direction: "in",
    alpha: 0.4,
    beta: 1,
    order: "desc"
  }) as kc
  return kc
} on my_hdc_graph

Result:

_idkatz_centrality
web10.681081665151973
web20.471519549878494
web60.419136320993772
web30.261956715748936
web40.20956622151173
web50.136218518184715
web70.0838273050914304

Stream Return

exec{
  algo(katz_centrality).params({
    return_id_uuid: "id",    
    max_loop_num: 100,
    tolerance: 0.00001,
    edge_weight_property: "value",
    direction: "in",
    alpha: 0.4,
    beta: 1,
    order: "desc"
  }).stream() as kc
  return kc
} on my_hdc_graph

Result:

_idkatz_centrality
web10.681081665151973
web20.471519549878494
web60.419136320993772
web30.261956715748936
web40.20956622151173
web50.136218518184715
web70.0838273050914304