NETWORK.REACH OpenBI
The nodes reached from flagged ones, and in how many hops.
Group: Networks. OpenBI’s own: DAX has no function of this name.
Syntax
NETWORK.REACH ( <links>, <from>, <to>, <seeds>, <seed> [, <hops>] [, <direction>] )
| 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. |
seeds | Table | The flagged rows the spreading starts from, such as FILTER ( Accounts, Accounts[Flagged] ). |
seed | Expression evaluated for each row | The node of each row of seeds. |
hops | Whole number optional | How many links away to go at most. Left out, as far as the links lead. |
direction | Text optional | "out" (when left out) follows each link from its first end to its second, where the money went; "in" goes back to where it came from; "both" takes either way. |
Returns
Table. A row a node reached, nearest first, with the columns Node, Hops and Seed.
Remarks
- The flagged nodes themselves come first, at 0 hops. Hops is the fewest links from the nearest flagged node, and Seed is that node (one of them, on a tie).
- Only the nodes reached are listed. The links always have a direction here: from to to.
- Seeds that are not nodes of the network are passed over; when none of them is, the call is an error.
- For a score rather than a distance, use
NETWORK.PROPAGATE.
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
Where the money from D went
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 }
}
)
VAR Flagged = DATATABLE ( "Account", STRING, { { "D" } } )
RETURN
NETWORK.REACH ( Payments, [Payer], [Payee], Flagged, [Account] )
| Node | Hops | Seed |
|---|---|---|
| D | 0 | D |
| E | 1 | D |
| C | 2 | D |
| F | 2 | D |
| A | 3 | D |
| B | 4 | D |
Where D's money came from, two steps back
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 }
}
)
VAR Flagged = DATATABLE ( "Account", STRING, { { "D" } } )
RETURN
NETWORK.REACH ( Payments, [Payer], [Payee], Flagged, [Account], 2, "in" )
| Node | Hops | Seed |
|---|---|---|
| D | 0 | D |
| C | 1 | D |
| B | 2 | D |
| E | 2 | D |
Two flagged friends
Each node reached says which of the two it is nearest to.
EVALUATE
VAR Links =
DATATABLE (
"From", STRING, "To", STRING,
{
{ "Ann", "Bo" }, { "Ann", "Cy" }, { "Bo", "Cy" }, { "Cy", "Di" },
{ "Di", "Ed" }, { "Ed", "Fay" }, { "Di", "Fay" }, { "Fay", "Gus" }
}
)
VAR Flagged = DATATABLE ( "Person", STRING, { { "Ann" }, { "Gus" } } )
RETURN
NETWORK.REACH ( Links, [From], [To], Flagged, [Person], , "both" )
| Node | Hops | Seed |
|---|---|---|
| Ann | 0 | Ann |
| Gus | 0 | Gus |
| Bo | 1 | Ann |
| Cy | 1 | Ann |
| Fay | 1 | Gus |
| Di | 2 | Ann |
| Ed | 2 | Gus |
Related functions
NETWORK.PROPAGATE, NETWORK.PATH, NETWORK.SIR.NODES, FILTER.
NETWORK.REACH is OpenBI's own code: it calls no function of Open Graph, OpenBI's graph library. See the OAX network functions and Open Graph.