NETWORK.CENTRALITY OpenBI
Each node's centrality: fan-in and fan-out, closeness, eigenvector, hubs and authorities, clustering.
Group: Networks. OpenBI’s own: DAX has no function of this name.
Syntax
NETWORK.CENTRALITY ( <links>, <from>, <to> [, <weight>] [, <directed>] )
| Parameter | Type | Description |
|---|---|---|
links | Table | The rows that make the network, one link a row: a table of the model or a table expression, as the filters leave it. |
from | Expression evaluated for each row | One end of each row's link, such as a payer, a customer or a place. |
to | Expression evaluated for each row | The other end of each row's link. |
weight | Expression optional, evaluated for each row | How heavy each row's link is, such as an amount or a count; never negative. Left out, or given as the constant BLANK (), every row weighs 1. |
directed | Boolean optional | TRUE when each link runs one way, from its first end to its second. FALSE or left out, a link works both ways. |
Returns
Table. A row a node. Its columns: Node; In degree and Out degree; In weight and Out weight; Closeness and Eigenvector; Hub and Authority; Clustering and Eccentricity; and Strong component when the network is directed, Component when it is not.
Remarks
- In degree and Out degree count the links coming in and going out, In weight and Out weight add up their weights: fan-in and fan-out. In a network that is not directed, in and out are the same.
- Closeness is the mean of 1 / hops from the node to each other node, a node it can't reach adding 0: 1 when it is linked to all of them. Directed, it follows the links going out.
- Eigenvector is high for a node linked to nodes that are themselves important, the largest 1; it uses the weights, and directed, the importance flows in along the links.
- Hub and Authority are Kleinberg's scores, for a directed network only (blank otherwise): a good hub points to good authorities. The largest of each is 1.
- Clustering is the share of a node's pairs of neighbours that are linked to each other; 0 for a node with fewer than two neighbours. Eccentricity is the most hops from the node to any node it can reach, links taken both ways.
- Strong component numbers the groups of nodes that can all reach each other along the directed links, such as a ring money can go round; 1 is the largest.
- Rows where an end is blank, or where both ends are the same node, add no link; the end that is there still counts as a node.
- To give a later argument without an earlier optional one, leave that one empty, with nothing between the commas:
( Payments, [Payer], [Payee], , TRUE )is directed and unweighted.
Compared with DAX
An OpenBI function: DAX has none like it, so a measure or query that uses it works in OpenBI only, not in Power BI or Analysis Services.
Examples
Seven friends
Di is closest to everyone; Ann and Bo sit in a closed triangle (clustering 1).
EVALUATE
VAR Links =
DATATABLE (
"From", STRING, "To", STRING,
{
{ "Ann", "Bo" }, { "Ann", "Cy" }, { "Bo", "Cy" }, { "Cy", "Di" },
{ "Di", "Ed" }, { "Ed", "Fay" }, { "Di", "Fay" }, { "Fay", "Gus" }
}
)
RETURN
SELECTCOLUMNS (
NETWORK.CENTRALITY ( Links, [From], [To] ),
"Node", [Node],
"Closeness", [Closeness],
"Eigenvector", [Eigenvector],
"Clustering", [Clustering],
"Eccentricity", [Eccentricity]
)
| Node | Closeness | Eigenvector | Clustering | Eccentricity |
|---|---|---|---|---|
| Ann | 0.569444444444445 | 0.603884504218098 | 1 | 4 |
| Bo | 0.569444444444445 | 0.603884504218098 | 1 | 4 |
| Cy | 0.722222222222222 | 0.891542819727318 | 0.333333333333333 | 3 |
| Di | 0.75 | 1 | 0.333333333333333 | 2 |
| Ed | 0.611111111111111 | 0.7435402942729 | 1 | 3 |
| Fay | 0.694444444444445 | 0.841263461379584 | 0.333333333333333 | 3 |
| Gus | 0.472222222222222 | 0.339719597306592 | 0 | 4 |
Payments: hubs and authorities
Directed and unweighted. E pays two accounts and B pays C, the account most paid into: they are the hubs, C and F the authorities. F pays nobody, so it is a strong component of its own.
EVALUATE
VAR Payments =
DATATABLE (
"Payer", STRING, "Payee", STRING, "Amount", INTEGER,
{
{ "A", "B", 100 }, { "B", "C", 80 }, { "C", "A", 60 }, { "C", "D", 50 },
{ "D", "E", 40 }, { "E", "C", 30 }, { "E", "F", 20 }
}
)
RETURN
SELECTCOLUMNS (
NETWORK.CENTRALITY ( Payments, [Payer], [Payee], , TRUE ),
"Node", [Node],
"In degree", [In degree],
"Out degree", [Out degree],
"Hub", [Hub],
"Authority", [Authority],
"Strong component", [Strong component]
)
| Node | In degree | Out degree | Hub | Authority | Strong component |
|---|---|---|---|---|---|
| A | 1 | 1 | 5.92349945142364e-17 | 1.97136523050788e-16 | 1 |
| B | 1 | 1 | 0.618033988749895 | 3.66092399332116e-17 | 1 |
| C | 2 | 2 | 3.18973594720152e-16 | 1 | 1 |
| D | 1 | 1 | 5.92349945142364e-17 | 1.97136523050788e-16 | 1 |
| E | 1 | 2 | 1 | 3.66092399332116e-17 | 1 |
| F | 1 | 0 | 0 | 0.618033988749895 | 2 |
Related functions
NETWORK.NODES, NETWORK.GRAPH, NETWORK.PROPAGATE, NETWORK.COMMUNITIES.
Open Graph, OpenBI's graph library, does the work: strength, harmonic_centrality, eigenvector_centrality, hub_and_authority_scores, transitivity_local_undirected, eccentricity, connected_components. See the OAX network functions and Open Graph.