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> )
| Parameter | Type | Description |
|---|---|---|
table | Table | The communities to number, a row a node, such as this month's NETWORK.COMMUNITIES. |
node | Expression evaluated for each row | The node of each row of table. |
community | Expression evaluated for each row | Its community: a number, a text or any value. |
reference | Table | The communities whose numbers are kept, a row a node, such as last month's. |
reference node | Expression evaluated for each row | The node of each row of reference. |
reference community | Expression 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] )
| Node | Community | Original | Shared |
|---|---|---|---|
| Ann | 1 | 2 | 2 |
| Bo | 1 | 2 | 2 |
| Cy | 2 | 1 | 3 |
| Di | 2 | 1 | 3 |
| Ed | 2 | 1 | 3 |
| Fay | 2 | 1 | 3 |
| Hal | 3 | 3 | 0 |
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]
)
| Node | Community | Original | Shared |
|---|---|---|---|
| Ann | 2 | 1 | 2 |
| Bo | 2 | 1 | 2 |
| Cy | 3 | 3 | 0 |
| Di | 4 | 4 | 0 |
| Ed | 5 | 5 | 0 |
| Fay | 1 | 2 | 2 |
| Gus | 1 | 2 | 2 |
Related functions
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.