NETWORK.LINKS OpenBI
Measures every link of the network a table's rows make, as NETWORK.NODES does every node: its betweenness, whether it is a bridge and which block it is in.
Group: Networks. OpenBI’s own: DAX has no function of this name.
Syntax
NETWORK.LINKS ( <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 link, with the columns From, To, Weight, Betweenness, Bridge and Block.
Remarks
- Betweenness adds up, over the pairs of nodes, the share of their shortest paths (in hops) that run along the link, the pair it joins included. The only road between two parts of a network scores high. The weights don't change it: every link is one hop.
- Directed, the paths follow the links' direction, and two nodes linked both ways make two rows.
- Bridge is TRUE when losing the link alone splits its part of the network: among the links, what a cut point of
NETWORK.NODESis among the nodes. - Block numbers the network's blocks: the parts that stay in one piece whichever one of their nodes is lost. A bridge is a block of its own. 1 is the block with the most nodes, then the most links; between two alike, the one whose first link comes first.
- Bridge and Block take the links both ways: two nodes linked both ways are one link to them, and both its rows say the same.
- The links come as
NETWORK.EDGESlists them: by their first end, then their second, in the nodes' order; not directed, a link's smaller value is its From. - On a very large network (nodes times links above four billion), betweenness counts only the shortest paths of up to five hops.
- 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.
- With a weight, a row whose weight is blank or 0 adds no link either.
- 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. - 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.
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
The links that hold seven friends together
The link between Cy and Di, the only one between the two triangles, carries the most shortest paths: 12, every pair from one side to the other. It is a bridge, as is Fay's link to Gus; each triangle is a block.
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
NETWORK.LINKS ( Links, [From], [To] )
| From | To | Weight | Betweenness | Bridge | Block |
|---|---|---|---|---|---|
| Ann | Bo | 1 | 1 | FALSE | 1 |
| Ann | Cy | 1 | 5 | FALSE | 1 |
| Bo | Cy | 1 | 5 | FALSE | 1 |
| Cy | Di | 1 | 12 | TRUE | 3 |
| Di | Ed | 1 | 4 | FALSE | 2 |
| Di | Fay | 1 | 8 | FALSE | 2 |
| Ed | Fay | 1 | 2 | FALSE | 2 |
| Fay | Gus | 1 | 6 | TRUE | 4 |
The roads a supply chain can't lose
The loop of the supplier, the two plants and Depot N is block 1: any one of its roads can close and the rest still connects. Every other road is a bridge. The road between Plant B and Depot S carries 18 shortest paths, the 18 pairs NETWORK.WEAKPOINTS says its loss would cut.
EVALUATE
VAR Chain =
DATATABLE (
"From", STRING, "To", STRING, "Pallets", INTEGER,
{
{ "Supplier", "Plant A", 40 }, { "Supplier", "Plant B", 25 }, { "Plant A", "Depot N", 30 },
{ "Plant B", "Depot N", 10 }, { "Plant B", "Depot S", 20 }, { "Depot N", "Shop 1", 12 },
{ "Depot N", "Shop 2", 9 }, { "Depot S", "Shop 3", 14 }, { "Shop 3", "Shop 4", 6 }
}
)
RETURN
NETWORK.LINKS ( Chain, [From], [To], [Pallets] )
| From | To | Weight | Betweenness | Bridge | Block |
|---|---|---|---|---|---|
| Depot N | Plant A | 30 | 6.5 | FALSE | 1 |
| Depot N | Plant B | 10 | 15.5 | FALSE | 1 |
| Depot N | Shop 1 | 12 | 8 | TRUE | 2 |
| Depot N | Shop 2 | 9 | 8 | TRUE | 3 |
| Depot S | Plant B | 20 | 18 | TRUE | 4 |
| Depot S | Shop 3 | 14 | 14 | TRUE | 5 |
| Plant A | Supplier | 40 | 4.5 | FALSE | 1 |
| Plant B | Supplier | 25 | 7.5 | FALSE | 1 |
| Shop 3 | Shop 4 | 6 | 8 | TRUE | 6 |
Payments one way
Directed, the paths follow the money: the payment from D to E lies on the most of them. E to F is the only bridge.
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
NETWORK.LINKS ( Payments, [Payer], [Payee], [Amount], TRUE )
| From | To | Weight | Betweenness | Bridge | Block |
|---|---|---|---|---|---|
| A | B | 100 | 8 | FALSE | 1 |
| B | C | 80 | 9 | FALSE | 1 |
| C | A | 60 | 7 | FALSE | 1 |
| C | D | 50 | 10 | FALSE | 2 |
| D | E | 40 | 11 | FALSE | 2 |
| E | C | 30 | 7 | FALSE | 2 |
| E | F | 20 | 5 | TRUE | 3 |
Related functions
NETWORK.NODES, NETWORK.EDGES, NETWORK.WEAKPOINTS, NETWORK.FLOW.
Open Graph, OpenBI's graph library, does the work: edge_betweenness_cutoff, edge_betweenness, bridges, biconnected_components. See the OAX network functions and Open Graph.