OpenBI Docs Buy

NETWORK.MATCH OpenBI

Numbers one partition's communities as another's (an earlier snapshot's), each after the one it shares the most nodes with, so a community keeps its number and colour.

Group: Networks. OpenBI’s own: DAX has no function of this name.

Syntax

NETWORK.MATCH ( <table>, <node>, <community>, <reference>, <reference node>, <reference community> )
ParameterTypeDescription
tableTableThe communities to number, a row a node, such as this month's NETWORK.COMMUNITIES.
nodeExpression
evaluated for each row
The node of each row of table.
communityExpression
evaluated for each row
Its community: a number, a text or any value.
referenceTableThe communities whose numbers are kept, a row a node, such as last month's.
reference nodeExpression
evaluated for each row
The node of each row of reference.
reference communityExpression
evaluated for each row
Its community: a whole number, as NETWORK.COMMUNITIES and NETWORK.NODES give them.

Returns

Table. A row a node of table, in the nodes' order, with the columns Node, Community (its new number), Original (its community in table) and Shared.

Remarks

  • Each community of table takes the number of one community of reference, one to one, so that as many nodes as can be keep their number: a community that stays, give or take a few nodes, keeps its number, and so its colour on a page.
  • Shared is how many nodes the community shares with the reference's community whose number it takes. A community left without one (it shares no node with a community of reference not already taken) gets a new number after the reference's largest, the larger communities first, and Shared 0.
  • The reference's communities must be whole numbers; table's can be anything. With an empty reference, the communities are numbered from 1, the largest first.
  • A row whose node or community is blank is left out. A node in two communities of one table is an error; the same row twice is not. Nodes are matched the way OAX compares values: text without regard to case, and 1 and 1.0 the same.

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

This month's communities under last month's numbers

This month's community 2, Ann and Bo, was part of last month's 1, so it takes number 1; this month's 1 shares three nodes with last month's 2 and takes 2. Hal's is new: it takes 3, after last month's largest.

EVALUATE
VAR LastMonth =
    DATATABLE (
        "Node", STRING, "Community", INTEGER,
        {
            { "Ann", 1 }, { "Bo", 1 }, { "Cy", 1 }, { "Di", 2 }, { "Ed", 2 }, { "Fay", 2 }, { "Gus", 2 }
        }
    )
VAR ThisMonth =
    DATATABLE (
        "Node", STRING, "Community", INTEGER,
        {
            { "Ann", 2 }, { "Bo", 2 }, { "Cy", 1 }, { "Di", 1 }, { "Ed", 1 }, { "Fay", 1 }, { "Hal", 3 }
        }
    )
RETURN
    NETWORK.MATCH ( ThisMonth, [Node], [Community], LastMonth, [Node], [Community] )
NodeCommunityOriginalShared
Ann122
Bo122
Cy213
Di213
Ed213
Fay213
Hal330

Numbers that stay as the resolution changes

At resolution 3, Ann and Bo keep the number of their group of three, Fay and Gus that of their group of four. Cy, Di and Ed, each on their own, are numbered from 3.

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.MATCH (
        NETWORK.COMMUNITIES ( Links, [From], [To], , "louvain", 3 ), [Node], [Community],
        NETWORK.COMMUNITIES ( Links, [From], [To] ), [Node], [Community]
    )
NodeCommunityOriginalShared
Ann212
Bo212
Cy330
Di440
Ed550
Fay122
Gus122

NETWORK.COMPARE, NETWORK.COMMUNITIES, NETWORK.NODES.

NETWORK.MATCH 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