OpenBI Docs Buy

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>] )
ParameterTypeDescription
linksTableThe rows that make the network, one link a row: a table of the model or a table expression, as the filters leave it.
fromExpression
evaluated for each row
One end of each row's link, such as a payer, a customer or a place.
toExpression
evaluated for each row
The other end of each row's link.
weightExpression
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.
directedBoolean
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]
    )
NodeClosenessEigenvectorClusteringEccentricity
Ann0.5694444444444450.60388450421809814
Bo0.5694444444444450.60388450421809814
Cy0.7222222222222220.8915428197273180.3333333333333333
Di0.7510.3333333333333332
Ed0.6111111111111110.743540294272913
Fay0.6944444444444450.8412634613795840.3333333333333333
Gus0.4722222222222220.33971959730659204

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]
    )
NodeIn degreeOut degreeHubAuthorityStrong component
A115.92349945142364e-171.97136523050788e-161
B110.6180339887498953.66092399332116e-171
C223.18973594720152e-1611
D115.92349945142364e-171.97136523050788e-161
E1213.66092399332116e-171
F1000.6180339887498952

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.

Last updated · OpenBI Studio 0.3.78