Networks
Who is connected and who matters: customers and products, accounts and payments, people and teams. A notebook measures a network from a table of edges in the model, on the rows the person running it may see.
Measure a network
Network(table, from, to) takes a table of the model (or any OAX table expression, such as a FILTER), the two ends of each edge as OAX on its rows, and an optional weight. Rows between the same two nodes add up:
// shops and products, linked by the liters each shop buys of each product
var net = Network("Sales", "Sales[Shop]", "Sales[Product]", weight: "Sales[Liters]");
net
Each node is measured: its degree and weight, PageRank, betweenness, community, component, k-core and whether it is a cut point, a node whose loss would split the network. directed: true when an edge goes one way.
Who matters
net.Top(5).Select("Node", "PageRank", "Betweenness", "Community", "Degree")
| Node | PageRank | Betweenness | Community | Degree |
|---|---|---|---|---|
| Pils | 0.2339 | 26.25 | 2 | 15 |
| IPA | 0.1024 | 26.25 | 1 | 15 |
| Cider | 0.09384 | 26.25 | 1 | 15 |
| Shop St. Hanshaugen | 0.04982 | 0.4 | 2 | 4 |
| Lettøl | 0.04643 | 26.25 | 2 | 15 |
In words
Explain() says the network’s structure; Explain(node) why one node matters:
string.Join(Environment.NewLine, net.Explain().Concat(net.Explain("IPA")))
19 nodes and 60 edges: 2 communities (modularity 0.37, a clear structure), all linked.
The most central (PageRank): Pils (0.234), IPA (0.102), Cider (0.094).
The bridges (most shortest paths run through them): Cider, IPA, Lettøl.
No cut points: no single node holds the network together.
IPA ranks 2nd of 19 by PageRank (0.1024) and 1st by betweenness: many shortest paths between others run through it.
15 neighbours (degree 1st), weight 331,884: Shop Bjørvika, Shop Frogner, Shop Grønland, Shop Grünerløkka, Shop Kampen, Shop Majorstuen, Shop Nydalen, Shop Sagene and 7 more.
In community 1 (10 nodes); it links it to community 2 (7 neighbours).
In the network's densest part (its 4-core).
Communities and paths
Community(1) lists the largest community’s nodes, and Path(a, b) a shortest path between two nodes:
net.Community(1).Select("Node", "PageRank", "Community")
| Node | PageRank | Community |
|---|---|---|
| Cider | 0.09384 | 1 |
| IPA | 0.1024 | 1 |
| Shop Bjørvika | 0.02819 | 1 |
| Shop Grønland | 0.03085 | 1 |
| Shop Grünerløkka | 0.0406 | 1 |
| Shop Kampen | 0.0275 | 1 |
The first 6 of its 10 rows.
Open Graph
Networks are measured with Open Graph, Norway Analytics’ own graph library, built into the engine: in notebooks, in the NETWORK.* functions and in the <obi-network> visual. It is API-compatible with igraph 1.0’s C interface (its functions named og_ where igraph’s are igraph_), and its answers are checked against python-igraph’s.
The nodes’ order. Nodes are numbered by their values, and results list them in that order: numbers from the smallest, then text by character code with capitals read as small letters, then dates, then FALSE and TRUE. Rows that come in another order give the same answers, communities and ties included. Above, four products tie on betweenness, and Explain() names the first three of them in that order. Where more than one answer is right, such as one of several shortest paths or of several maximum flows, one is given, the same every time.
Graph is Open Graph’s graph in a notebook’s C# steps. Made from a table of edges the model gives the step (the rows the person running it may see, row-level security applied), it holds the nodes the NETWORK.* functions would, in the same order, and every measure comes back as a table. New in 0.3.78 Graph.Rollup gives what NETWORK.ROLLUP gives, to the last bit: totals along every path from a set of starts, for a bill of materials, ownership through chains of companies or costs allocated back and forth. Og calls any function of Open Graph. Both are described in the Open Graph reference, under In notebooks; Graph’s members are also in the Networks reference.
NETWORK.SENSITIVITY says how each node’s measure moves as each link’s weight changes. A request it expects to need more than about 20 seconds is refused at once, saying how long it would take, and so is one of more than 500,000 rows (links times nodes): narrow the table down to the links you care about, or ask for one node.
Keep it
Results.Save("Who buys what", net) keeps the network as a draft version; approved and in use, its nodes, with their measures, are a table of the model. On report pages, <obi-network> and the NETWORK.* functions measure a network live, on the rows in view. Every member is in the Networks reference.