Graph Analysis
The network layer in MapWeave comes with a number of graph analysis functions which you can use to add insight to your data.
Using these functions, you can score your data and then use these scores for example to add meaningful node styling that identifies the most influential nodes or highlights the connections of a selected node.
The graph analysis functions are powered by a graph engine which runs separately from the graph rendering methods. The available functions are:
Function | Definition |
---|---|
betweenness() | Measures the number of times a node lies on the shortest path between other nodes. Shows important nodes that would have the greatest impact on the network connectivity if removed. |
components() | Calculates the separate 'connected components' of the graph. |
degrees() | Measures the number of direct, 'one hop' connections each node has to other nodes within the network. Shows very connected nodes which can quickly connect with the wider network. |
neighbors() | Finds the nodes that are linked to the node or nodes passed in. |
Running analysis on data
Call the
createGraphEngine()
function
to create a graph engine instance,
and pass the data in the NetworkLayerData
format
to the function to analyze the data:
const graphEngine = networkLayer.createGraphEngine(networkData);
And then use the graph engine to run the graph function, for example:
const results = graphEngine.betweenness();
The graph function returns a result which you can use for example to style the nodes.
Running analysis on the network layer
Alternatively, you can call the
getGraphEngine()
function directly on a network layer.
Use this approach to work with the data loaded into the network layer:
- When the
timeFilterRange
option is set, the analysis only runs on the filtered graph - When the
proximityCombine
is set to true, the analysis only runs on the combined nodes and ignores their underlying children
const graphEngine = networkLayer.getGraphEngine();
const results = graphEngine.betweenness();
See the Highlighting Neighbors
example to try the neighbors()
graph analysis function.