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>] )
| 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; 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]
)
| Node | Betweenness | Cut point | Degree | Community |
|---|---|---|---|---|
| Ann | 0 | FALSE | 2 | 2 |
| Bo | 0 | FALSE | 2 | 2 |
| Cy | 8 | TRUE | 3 | 2 |
| Di | 9 | TRUE | 3 | 1 |
| Ed | 0 | FALSE | 2 | 1 |
| Fay | 5 | TRUE | 3 | 1 |
| Gus | 0 | FALSE | 1 | 1 |
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
| Node | Betweenness | Degree | Weight | Community |
|---|---|---|---|---|
| Shop Bjørvika | 22.4666666666667 | 7 | 12 | 1 |
| Shop Grünerløkka | 17.6 | 7 | 11 | 1 |
| Shop Majorstuen | 11.3333333333333 | 4 | 8 | 3 |
| Shop Skøyen | 10.4166666666667 | 3 | 6 | 3 |
| Shop Torshov | 9.75 | 7 | 13 | 2 |
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]
)
| Node | Degree | Weight | PageRank | Core |
|---|---|---|---|---|
| A | 2 | 160 | 0.162617763090624 | 2 |
| B | 2 | 180 | 0.176251445732675 | 2 |
| C | 4 | 220 | 0.268726583497167 | 2 |
| D | 2 | 90 | 0.141852527093186 | 2 |
| E | 3 | 90 | 0.158600995134853 | 2 |
| F | 1 | 20 | 0.0919506854514943 | 1 |
Related functions
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.