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.
| Parameter | Description |
|---|---|
| auth | Specifies how to calculate authority centrality. |
| between | Specifies how to calculate betweenness centrality. |
| betweenNorm | When set to True, normalizes the betweenness centrality calculation. |
| close | Specifies how to calculate closeness centrality. |
| closeNoPath | Specifies a method of accounting for the shortest path distance between two nodes when a path does not exist. |
| clusteringCoefficient | When set to True, calculates the node clustering coefficient. |
| degree | Specifies how to calculate degree centrality. |
| deterministic | When set to True, ensures that each invocation produces the same final result. |
| direction | Specifies whether to consider the input graph as directed or undirected. |
| display | Specifies a list of results tables to send to the client for display. |
| distributed | When set to True, uses a distributed graph. |
| eigen | Specifies how to calculate eigenvector centrality. |
| eigenAlgorithm | Specifies the algorithm to use in calculating centrality metrics that require solving eigensystems. |
| eigenMaxIters | Specifies the maximum number of iterations to use for eigenvector calculations. |
| graph | Specifies the in-memory graph to use. |
| hub | Specifies how to calculate hub centrality. |
| indexOffset | Specifies the index offset for identifiers in the log and results output data tables. |
| influence | Specifies how to calculate influence centrality. |
| links | Specifies the input data table that contains the graph link information. |
| linksVar | Specifies the data variable names for the links table. |
| logFreqTime | Controls the frequency in seconds for displaying iteration logs. |
| logLevel | Controls the amount of information that is displayed in the SAS log. |
| multiLinks | When set to True, includes multilinks when an input graph is read. |
| nodes | Specifies the input data table that contains the graph node information. |
| nodesVar | Specifies the data variable names for the nodes table. |
| nThreads | Specifies the maximum number of threads to use for multithreaded processing. |
| outGraphList | Specifies the output data table to contain summary information about in-memory graphs. |
| outLinks | Specifies the output data table to contain the graph link information along with any results from the algorithms that calculate metrics on links. |
| outNodes | Specifies the output data table to contain the graph node information along with any results from the algorithms that calculate metrics on nodes. |
| outputTables | Lists the names of results tables to save as CAS tables on the server. |
| pageRank | Specifies how to calculate PageRank centrality. |
| pageRankAlpha | Specifies the damping factor for the PageRank algorithm. |
| pageRankTolerance | Specifies the convergence tolerance for the PageRank algorithm. |
| samplePercent | Specifies the percentage of source nodes to sample for the approximate betweenness calculation. |
| selfLinks | When set to True, includes self-links when an input graph is read. |
| standardizedLabels | When set to True, specifies that the input graph data are in a standardized format. |
| standardizedLabelsOut | When set to True, requests that the output graph data include standardized format. |
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.
| 1 | DATA mycas.Links; |
| 2 | INFILE DATALINES missover; |
| 3 | INPUT from $ to $ weight; |
| 4 | DATALINES; |
| 5 | A B 1.0 |
| 6 | A C 1.0 |
| 7 | A D 1.0 |
| 8 | B C 2.0 |
| 9 | B E 1.0 |
| 10 | C D 1.0 |
| 11 | D E 1.0 |
| 12 | E F 1.0 |
| 13 | F G 1.0 |
| 14 | ; |
| 15 | RUN; |
| 16 | |
| 17 | DATA mycas.Nodes; |
| 18 | INFILE DATALINES missover; |
| 19 | INPUT node $; |
| 20 | DATALINES; |
| 21 | A |
| 22 | B |
| 23 | C |
| 24 | D |
| 25 | E |
| 26 | F |
| 27 | G |
| 28 | ; |
| 29 | RUN; |
This example calculates the unweighted degree centrality for each node in the graph. The results are stored in the `mycas.Centrality` output table.
| 1 | PROC CAS; |
| 2 | network.centrality / |
| 3 | links={name='Links'} |
| 4 | nodes={name='Nodes'} |
| 5 | degree='UNWEIGHT' |
| 6 | outNodes={name='Centrality', replace=true}; |
| 7 | RUN; |
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.
| 1 | PROC 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}; |
| 9 | RUN; |
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.
| 1 | PROC CAS; |
| 2 | network.centrality / |
| 3 | links={name='Links'} |
| 4 | direction='DIRECTED' |
| 5 | pageRank='WEIGHT' |
| 6 | eigen='WEIGHT' |
| 7 | outNodes={name='NodeCentrality', replace=true}; |
| 8 | RUN; |
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...
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 ...
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...