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:

  • 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 Graph Analysis

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 nodes.

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 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();

First you need to import the createNetworkGraphEngine() function to enable the graph engine in the network layer:

import { NetworkLayer, createNetworkGraphEngine } from 'mapweave/react/layers';

Once it's imported, call createNetworkGraphEngine() to create a graph engine instance, and pass the data in the NetworkLayerData format to the function to analyze the data:

const graphEngine = createNetworkGraphEngine(networkData);

And then use the graph engine to run any of the graph functions available, for example:

const results = graphEngine.betweenness();

The graph function returns a result which you can use, for example, to style the nodes.

Terms of use

These terms do not alter or supersede any existing agreements between you (or your employer) and us.

By accessing or using any Content you agree to be bound by these Terms of Use. Please review these terms carefully before using the website.

The contents of this website, including but not limited to any text, code samples, API references, schemas, interactive tools, and other materials (collectively, the 'Content'), are made available for informational and internal evaluation purposes only. All intellectual property rights in the Content are reserved. No licence is granted to use the Content for any commercial purpose, or to copy, distribute, modify, reverse-engineer, or incorporate any part of the Content into any product or service, without our prior written consent.

This Content is provided “as is” and “as available,” without any representations, warranties, or guarantees of any kind, whether express or implied, including but not limited to implied warranties of merchantability, fitness for a particular purpose, non-infringement, or accuracy. To the fullest extent permitted by applicable law, we expressly exclude and disclaim all implied warranties, conditions, and other terms that might otherwise be implied.

We disclaim all liability for any loss or damage, whether direct, indirect, incidental, consequential, or otherwise, arising from any reliance placed on the Content or from your use of it, to the fullest extent permitted by applicable law. By continuing to access or use the Content, you acknowledge and agree to these terms.