NETWORK.SIR.NODES OpenBI
Spreading through the network (the SIR model): how often and how soon each node is reached.
Group: Networks. OpenBI’s own: DAX has no function of this name.
Syntax
NETWORK.SIR.NODES ( <links>, <from>, <to>, <beta>, <gamma> [, <runs> [, <seeds>, <seed>]] )
| 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. |
beta | Number | How fast an infected node infects each neighbour that has not had it: infections per link per unit of time, 0 or more. |
gamma | Number | How fast an infected node recovers: recoveries per unit of time, above 0. 1 / gamma is how long a node stays infectious, on average. |
runs | Whole number optional | How many simulations are averaged, from 1 to 100,000: 100 when left out. |
seeds | Table optional | The rows whose nodes are infected at the start. Left out, each run starts at one node chosen at random. |
seed | Expression optional, evaluated for each row | The node of each row of seeds; it comes with seeds. |
Returns
Table. A row a node, with the columns Node, Reached, Mean time and Seed.
Remarks
- The SIR model: every node is susceptible, infected or recovered. An infected node passes it on along each link at the rate beta and recovers at the rate gamma, and a recovered node is not infected again. Time runs on continuously, not in rounds.
- The links are taken both ways, and no weight is used.
- The runs draw their random numbers from a fixed start, so the same query gives the same numbers every time; more runs give steadier ones.
- Reached is the share of the runs in which the node was infected. Mean time is when, on average over those runs; blank for a node never reached.
- Seed is TRUE for a node infected at the start of every run: the nodes of seeds.
- For the epidemic over time, use
NETWORK.SIR.
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 hears it, starting from Ann
Bo and Cy are reached most often and soonest; Gus, four links away, seldom.
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 Start = DATATABLE ( "Person", STRING, { { "Ann" } } )
RETURN
NETWORK.SIR.NODES ( Links, [From], [To], 0.5, 1, 1000, Start, [Person] )
| Node | Reached | Mean time | Seed |
|---|---|---|---|
| Ann | 1 | 0 | TRUE |
| Bo | 0.377 | 0.676643387786412 | FALSE |
| Cy | 0.386 | 0.686638412166125 | FALSE |
| Di | 0.154 | 1.31838293309686 | FALSE |
| Ed | 0.056 | 2.16719026316174 | FALSE |
| Fay | 0.066 | 2.14935713783886 | FALSE |
| Gus | 0.024 | 2.82800047403956 | FALSE |
Related functions
NETWORK.SIR, NETWORK.REACH, NETWORK.PROPAGATE.
NETWORK.SIR.NODES is OpenBI's own code: it calls no function of Open Graph, OpenBI's graph library. See the OAX network functions and Open Graph.