network

centrality

Description

The centrality action calculates various centrality metrics to identify the most important nodes in a network. These metrics measure a node's influence or importance based on its position within the graph structure. Key metrics include degree (number of connections), betweenness (role as a bridge), closeness (proximity to other nodes), and eigenvector-based measures like PageRank.

network.centrality <result=results> <status=rc> / auth="BOTH" | "UNWEIGHT" | "WEIGHT", between="BOTH" | "UNWEIGHT" | "WEIGHT", betweenNorm=TRUE | FALSE, close="BOTH" | "UNWEIGHT" | "WEIGHT", closeNoPath="DIAMETER" | "HARMONIC" | "NNODES" | "ZERO", clusteringCoefficient=TRUE | FALSE, degree="BOTH" | "UNWEIGHT" | "WEIGHT", deterministic=TRUE | FALSE, direction="DIRECTED" | "UNDIRECTED", display={...}, distributed=TRUE | FALSE, eigen="BOTH" | "UNWEIGHT" | "WEIGHT", eigenAlgorithm="AUTOMATIC" | "JACOBIDAVIDSON" | "POWER", eigenMaxIters=integer, graph=integer, hub="BOTH" | "UNWEIGHT" | "WEIGHT", indexOffset=integer, influence="BOTH" | "UNWEIGHT" | "WEIGHT", links={...}, linksVar={...}, logFreqTime=integer, logLevel="AGGRESSIVE" | "BASIC" | "MODERATE" | "NONE", multiLinks=TRUE | FALSE, nodes={...}, nodesVar={...}, nThreads=integer, outGraphList={...}, outLinks={...}, outNodes={...}, outputTables={...}, pageRank="BOTH" | "UNWEIGHT" | "WEIGHT", pageRankAlpha=double, pageRankTolerance=double, samplePercent=double, selfLinks=TRUE | FALSE, standardizedLabels=TRUE | FALSE, standardizedLabelsOut=TRUE | FALSE;
Settings
ParameterDescription
authSpecifies how to calculate authority centrality.
betweenSpecifies how to calculate betweenness centrality.
betweenNormWhen set to True, normalizes the betweenness centrality calculation.
closeSpecifies how to calculate closeness centrality.
closeNoPathSpecifies a method of accounting for the shortest path distance between two nodes when a path does not exist.
clusteringCoefficientWhen set to True, calculates the node clustering coefficient.
degreeSpecifies how to calculate degree centrality.
deterministicWhen set to True, ensures that each invocation produces the same final result.
directionSpecifies whether to consider the input graph as directed or undirected.
displaySpecifies a list of results tables to send to the client for display.
distributedWhen set to True, uses a distributed graph.
eigenSpecifies how to calculate eigenvector centrality.
eigenAlgorithmSpecifies the algorithm to use in calculating centrality metrics that require solving eigensystems.
eigenMaxItersSpecifies the maximum number of iterations to use for eigenvector calculations.
graphSpecifies the in-memory graph to use.
hubSpecifies how to calculate hub centrality.
indexOffsetSpecifies the index offset for identifiers in the log and results output data tables.
influenceSpecifies how to calculate influence centrality.
linksSpecifies the input data table that contains the graph link information.
linksVarSpecifies the data variable names for the links table.
logFreqTimeControls the frequency in seconds for displaying iteration logs.
logLevelControls the amount of information that is displayed in the SAS log.
multiLinksWhen set to True, includes multilinks when an input graph is read.
nodesSpecifies the input data table that contains the graph node information.
nodesVarSpecifies the data variable names for the nodes table.
nThreadsSpecifies the maximum number of threads to use for multithreaded processing.
outGraphListSpecifies the output data table to contain summary information about in-memory graphs.
outLinksSpecifies the output data table to contain the graph link information along with any results from the algorithms that calculate metrics on links.
outNodesSpecifies the output data table to contain the graph node information along with any results from the algorithms that calculate metrics on nodes.
outputTablesLists the names of results tables to save as CAS tables on the server.
pageRankSpecifies how to calculate PageRank centrality.
pageRankAlphaSpecifies the damping factor for the PageRank algorithm.
pageRankToleranceSpecifies the convergence tolerance for the PageRank algorithm.
samplePercentSpecifies the percentage of source nodes to sample for the approximate betweenness calculation.
selfLinksWhen set to True, includes self-links when an input graph is read.
standardizedLabelsWhen set to True, specifies that the input graph data are in a standardized format.
standardizedLabelsOutWhen set to True, requests that the output graph data include standardized format.
Data Preparation View data prep sheet
Creating the Input Data

This example creates a simple social network graph to demonstrate how to calculate centrality metrics. The `mycas.Links` table defines the connections (links) between individuals (nodes), and the `mycas.Nodes` table defines the individuals themselves.

Copied!
1DATA mycas.Links;
2 INFILE DATALINES missover;
3 INPUT from $ to $ weight;
4 DATALINES;
5A B 1.0
6A C 1.0
7A D 1.0
8B C 2.0
9B E 1.0
10C D 1.0
11D E 1.0
12E F 1.0
13F G 1.0
14;
15RUN;
16 
17DATA mycas.Nodes;
18 INFILE DATALINES missover;
19 INPUT node $;
20 DATALINES;
21A
22B
23C
24D
25E
26F
27G
28;
29RUN;

Examples

This example calculates the unweighted degree centrality for each node in the graph. The results are stored in the `mycas.Centrality` output table.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 network.centrality /
3 links={name='Links'}
4 nodes={name='Nodes'}
5 degree='UNWEIGHT'
6 outNodes={name='Centrality', replace=true};
7RUN;
Result :
The `mycas.Centrality` table is created, containing the nodes of the graph and their corresponding unweighted degree centrality scores.

This example calculates several centrality metrics simultaneously: degree (weighted and unweighted), betweenness (weighted), and closeness (weighted). It demonstrates how to request multiple metrics in a single call. The results are saved to the `mycas.Centrality_Detailed` table.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 network.centrality /
3 links={name='Links'}
4 nodes={name='Nodes'}
5 degree='BOTH'
6 between='WEIGHT'
7 close='WEIGHT'
8 outNodes={name='Centrality_Detailed', replace=true};
9RUN;
Result :
The `mycas.Centrality_Detailed` table is created, containing columns for each requested centrality metric: `cent_degree_wt`, `cent_degree_unwt`, `cent_between_wt`, and `cent_close_wt`.

This example computes PageRank and Eigenvector centrality for a directed graph. The `direction` parameter is set to 'DIRECTED', and the results are output to the `mycas.NodeCentrality` table.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 network.centrality /
3 links={name='Links'}
4 direction='DIRECTED'
5 pageRank='WEIGHT'
6 eigen='WEIGHT'
7 outNodes={name='NodeCentrality', replace=true};
8RUN;
Result :
The `mycas.NodeCentrality` table is generated, which includes columns for PageRank (`cent_pagerank_wt`) and Eigenvector centrality (`cent_eigen_wt`) for each node.

Associated Scenarios

Use Case
Anti-Money Laundering: Identifying Mules and Hubs

A financial institution wants to detect potential money laundering rings. They need to identify 'Hub' accounts (high transaction volume/degree) and 'Bridge' accounts (high betwe...

Use Case
Telecommunications: Critical Infrastructure Analysis (High Volume)

A telecommunications company manages a massive network of towers and fiber connections. They need to identify the most critical nodes for network resilience. Since the graph is ...

Use Case
Social Media: Influence in Fragmented Directed Networks

A marketing agency is analyzing a social media platform with directed 'follows'. The network is fragmented (distinct communities that don't interact). They need to calculate Pag...