OpenBI Docs Buy

NETWORK.NODES OpenBI

Measures every node of the network a table's rows make: its links, PageRank, betweenness, community, component, core and whether it is a cut point.

Group: Networks. OpenBI’s own: DAX has no function of this name.

Syntax

NETWORK.NODES ( <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; Degree and Weight; PageRank and Betweenness; Community, Component and Core; and Cut point.

Remarks

  • Degree is how many different nodes a node is linked to; Weight adds up the weights of its links, going out and coming in.
  • PageRank (damping 0.85) uses the weights and, in a directed network, the direction; over all nodes it adds up to 1. Betweenness adds up, over the pairs of other nodes, the share of their shortest paths (in hops) that run through the node.
  • Community is the Louvain community the node falls in, found on the network taken both ways and weighted. Component is its connected part of the network. Both are numbered from 1, the largest.
  • Core is the node's k-core: the largest k for which it sits in a part where every node has at least k links. Cut point is TRUE when taking the node away splits its part of the network apart.
  • On a very large network (nodes times links above four billion), betweenness counts only the shortest paths of up to five hops.
  • 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.
  • Several rows between the same two nodes make one link, and their weights add up. Without a weight each row adds 1, so a pair that appears three times weighs 3.
  • Nodes are compared the way OAX compares values: text without regard to case, and 1 and 1.0 are the same node. A node written two ways is shown with the spelling whose characters sort first by code (ALICE before Alice); a column of the model keeps one spelling of each text, the first it loaded.
  • The rows come out in the order of the nodes' values: numbers from the smallest, then text by character code with capitals read as small letters (A and a together, Ä after z), then dates, then FALSE and TRUE. Rows that come in another order give the same result, communities and ties included; up to 0.3.76 the order the rows came in could change them.
  • In a measure, the table is the rows the filters leave, so the network follows the slicers and the page: a visual measures the network of the rows in view.
  • The same rows always give the same communities: Louvain's random choices are fixed.

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

Who holds the group together

Cy and Di are the bridge between two triangles of friends, and Fay is Gus's only link: those three are cut points, and Di has the highest betweenness.

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.NODES ( Links, [From], [To] ),
        "Node", [Node],
        "Betweenness", [Betweenness],
        "Cut point", [Cut point],
        "Degree", [Degree],
        "Community", [Community]
    )
NodeBetweennessCut pointDegreeCommunity
Ann0FALSE22
Bo0FALSE22
Cy8TRUE32
Di9TRUE31
Ed0FALSE21
Fay5TRUE31
Gus0FALSE11

The places within eight minutes of each other

Driving times differ by direction: a pair within eight minutes both ways is one link of weight 2, one way only, of weight 1. The five places most often on the way between others:

EVALUATE
SELECTCOLUMNS (
    TOPN (
        5,
        NETWORK.NODES ( FILTER ( Distances, Distances[Minutes] <= 8 ), Distances[From], Distances[To] ),
        [Betweenness], DESC
    ),
    "Node", [Node],
    "Betweenness", [Betweenness],
    "Degree", [Degree],
    "Weight", [Weight],
    "Community", [Community]
)
ORDER BY [Betweenness] DESC
NodeBetweennessDegreeWeightCommunity
Shop Bjørvika22.46666666666677121
Shop Grünerløkka17.67111
Shop Majorstuen11.3333333333333483
Shop Skøyen10.4166666666667363
Shop Torshov9.757132

Payments one way, weighted by their amount

C, in both rings, has the most links, money and PageRank. F, at the end of the line, is the one node outside the core of 2.

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.NODES ( Payments, [Payer], [Payee], [Amount], TRUE ),
        "Node", [Node],
        "Degree", [Degree],
        "Weight", [Weight],
        "PageRank", [PageRank],
        "Core", [Core]
    )
NodeDegreeWeightPageRankCore
A21600.1626177630906242
B21800.1762514457326752
C42200.2687265834971672
D2900.1418525270931862
E3900.1586009951348532
F1200.09195068545149431

NETWORK.EDGES, NETWORK.CENTRALITY, NETWORK.COMMUNITIES, NETWORK.GRAPH, NETWORK.LAYOUT.

Open Graph, OpenBI's graph library, does the work: strength, pagerank, betweenness_cutoff, betweenness, coreness, connected_components, articulation_points, community_multilevel. See the OAX network functions and Open Graph.

Last updated · OpenBI Studio 0.3.78