NETWORK.SENSITIVITY OpenBI
The links each node's standing depends on: how fast each node's PageRank, eigenvector centrality, strength, closeness, harmonic centrality or betweenness moves as each link's weight changes.
Group: Networks. OpenBI’s own: DAX has no function of this name.
Syntax
NETWORK.SENSITIVITY ( <links>, <from>, <to>, <weight>, <measure> [, <node>] [, <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 evaluated for each row | Each row's weight, the one the derivatives are taken by; never negative. BLANK () counts every row as 1. For closeness, harmonic and betweenness it is the link's length, such as minutes. |
measure | Text | "pagerank", "eigenvector", "strength" (or "weight"), "closeness", "harmonic" or "betweenness", in capitals or not. |
node | Value optional | Only this node's rows: how its measure moves with each link. Left out, every node's. |
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 for each link and each node, a link's rows together; with a node, a row a link. Its columns: From, To and Weight, the link; Node and Value, the node's measure; Derivative; Column sum; and Note.
Remarks
- Derivative is how fast the node's measure moves as the link's weight grows, at the weights as they are: the change in the measure for each unit of weight added, as long as the change stays small. Above 0, a heavier link lifts the node; below 0, it pulls it down; 0, the link makes no difference to it.
- PageRank (with a damping of 0.85, and directed when the network is), eigenvector centrality (the largest 1) and strength (the weights of the node's links added up) move smoothly with the weights: their derivatives are slopes.
- For closeness, harmonic and betweenness the weight is a length, such as minutes or kilometres, and a shortest path is the one of least length. Closeness is 1 over the mean length to the nodes the node reaches; harmonic is the mean of 1 over the length to each other node, 0 for one it can't reach.
- Closeness and harmonic move in straight pieces as a length changes, and betweenness in jumps: their derivatives hold only close to the weights as they are. Between jumps betweenness is flat, so its derivative is 0, or a very large number where two shortest paths are equally long: a sign of that tie, not a slope. The Note column says so on every row of these three measures.
- Column sum adds up a link's derivatives over every node: 0 for PageRank, whose values always add up to 1, and 2 for strength, as a link's weight counts at both its ends.
- Value is the node's measure, the same on each of its rows.
- Every link by every node can be many rows: past 500,000 the call is an error, and so is one that would take too long (it says about how long). Give a node, or keep only the links that matter in the table. A node that is not in the network is an error too.
- To make the network directed for every node, leave the node empty:
( Roads, [From], [To], [Crates], "pagerank", , TRUE ). - 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.
- 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.
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
Which payments C's PageRank hangs on
Directed and weighted by the amounts. One more paid from E to C lifts C's PageRank by about 0.0009, and one more from E to F pulls it down by 0.0013, as more of E's money goes elsewhere. A, B and D each pay one account only, so their amounts make no difference.
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.SENSITIVITY ( Payments, [Payer], [Payee], [Amount], "pagerank", "C", TRUE ),
"From", [From],
"To", [To],
"Amount", [Weight],
"PageRank", ROUND ( [Value], 4 ),
"Derivative", ROUND ( [Derivative], 6 )
)
| From | To | Amount | PageRank | Derivative |
|---|---|---|---|---|
| A | B | 100 | 0.2687 | 0 |
| B | C | 80 | 0.2687 | 0 |
| C | A | 60 | 0.2687 | 0.000226 |
| C | D | 50 | 0.2687 | -0.000271 |
| D | E | 40 | 0.2687 | 0 |
| E | C | 30 | 0.2687 | 0.000894 |
| E | F | 20 | 0.2687 | -0.001341 |
One road, every node
One more crate a day on the road from Depot N to the shop lifts the PageRank of its two ends and pulls down the other two's: the four derivatives add up to 0.
EVALUATE
VAR Roads =
DATATABLE (
"From", STRING, "To", STRING, "Crates", INTEGER,
{
{ "Brewery", "Depot N", 8 }, { "Brewery", "Depot S", 7 }, { "Depot N", "Depot S", 3 },
{ "Depot N", "Shop", 4 }, { "Depot S", "Shop", 9 }
}
)
RETURN
SELECTCOLUMNS (
FILTER (
NETWORK.SENSITIVITY ( Roads, [From], [To], [Crates], "pagerank" ),
[From] = "Depot N" && [To] = "Shop"
),
"Node", [Node],
"PageRank", ROUND ( [Value], 4 ),
"Derivative", ROUND ( [Derivative], 6 ),
"Column sum", ROUND ( [Column sum], 9 )
)
| Node | PageRank | Derivative | Column sum |
|---|---|---|---|
| Brewery | 0.242 | -0.006755 | 0 |
| Depot N | 0.2435 | 0.007552 | 0 |
| Depot S | 0.3007 | -0.009003 | 0 |
| Shop | 0.2138 | 0.008205 | 0 |
Which drives the shop's closeness hangs on
Minutes are lengths here. The drive from Depot N to the shop is on its shortest ways to Depot N and to the brewery, so each extra minute on it costs twice what a minute on the drive from Depot S does. The drive between the depots is on none of them: 0.
EVALUATE
VAR Drive =
DATATABLE (
"From", STRING, "To", STRING, "Minutes", INTEGER,
{
{ "Brewery", "Depot N", 12 }, { "Brewery", "Depot S", 9 }, { "Depot N", "Depot S", 5 },
{ "Depot N", "Shop", 7 }, { "Depot S", "Shop", 11 }
}
)
RETURN
SELECTCOLUMNS (
NETWORK.SENSITIVITY ( Drive, [From], [To], [Minutes], "closeness", "Shop" ),
"From", [From],
"To", [To],
"Minutes", [Weight],
"Closeness", [Value],
"Derivative", [Derivative]
)
| From | To | Minutes | Closeness | Derivative |
|---|---|---|---|---|
| Brewery | Depot N | 12 | 0.0810810810810811 | -0.00219138056975895 |
| Brewery | Depot S | 9 | 0.0810810810810811 | 0 |
| Depot N | Depot S | 5 | 0.0810810810810811 | 0 |
| Depot N | Shop | 7 | 0.0810810810810811 | -0.0043827611395179 |
| Depot S | Shop | 11 | 0.0810810810810811 | -0.00219138056975895 |
Related functions
NETWORK.NODES, NETWORK.CENTRALITY, NETWORK.LINKS, NETWORK.PROPAGATE.
Open Graph, OpenBI's graph library, does the work: jacobian_full, jacobian_column, pagerank, eigenvector_centrality, strength, closeness, harmonic_centrality, betweenness. See the OAX network functions and Open Graph.