OpenBI Docs Buy

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>]] )
ParameterTypeDescription
linksTableThe rows that make the network, one link a row: a table of the model or a table expression, as the filters leave it.
fromExpression
evaluated for each row
One end of each row's link, such as a payer, a customer or a place.
toExpression
evaluated for each row
The other end of each row's link.
betaNumberHow fast an infected node infects each neighbour that has not had it: infections per link per unit of time, 0 or more.
gammaNumberHow fast an infected node recovers: recoveries per unit of time, above 0. 1 / gamma is how long a node stays infectious, on average.
runsWhole number
optional
How many simulations are averaged, from 1 to 100,000: 100 when left out.
seedsTable
optional
The rows whose nodes are infected at the start. Left out, each run starts at one node chosen at random.
seedExpression
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] )
NodeReachedMean timeSeed
Ann10TRUE
Bo0.3770.676643387786412FALSE
Cy0.3860.686638412166125FALSE
Di0.1541.31838293309686FALSE
Ed0.0562.16719026316174FALSE
Fay0.0662.14935713783886FALSE
Gus0.0242.82800047403956FALSE

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.

Last updated · OpenBI Studio 0.3.78