Skip to main content

MAGE - Memgraph Advanced Graph Extensions 🔮

Memgraph Advanced Graph Extensions, MAGE to friends, is an open-source repository that contains graph algorithms and modules written by the team behind Memgraph and its users in the form of query modules. The project aims to give everyone the tools they need to tackle the most interesting and challenging graph analytics problems.

Query module is a concept introduced by Memgraph and it refers to user-defined procedures, grouped into modules that extend the Cypher query language. Procedures are implementations of various algorithms in multiple programming languages and they are all runnable inside Memgraph.

Quick start

Start utilizing the power of MAGE with these simple steps.

1. Install MAGE

If you are using Memgraph Platform and starting Memgraph with the memgraph-platform image, MAGE is already included and you can proceed to step 2 or 3.

Install MAGE using a prepared image from the Docker Hub or by building a Docker image from the official MAGE GitHub repository. On Linux, you can also install MAGE from source but be aware you will also need to install additional dependencies.

2. Load query modules

To use certain procedures, first, you need to load the query modules to the appropriate directory.

3. Call procedures

You are ready to call procedures within queries and tackle that graph analytics problem that's been keeping you awake.

What to do next?

Browse the spellbook of query modules

The spellbook has been written to help you utilize all the currently available query modules.

Spellbook 📖

Traditional graph algorithms

betweenness_centralityC++The betweenness centrality of a node is defined as the sum of the of all-pairs shortest paths that run through the node, divided by the number of all-pairs shortest paths in the graph. The algorithm has O(nm) time complexity.
biconnected_componentsC++Algorithm for calculating maximal biconnected subgraph. A biconnected subgraph is a subgraph with a property that if any vertex were to be removed, the graph will remain connected.
bipartite_matchingC++Algorithm for calculating maximum bipartite matching, where matching is a set of nodes chosen in such a way that no two edges share an endpoint.
bridgesC++A bridge is an edge, which when deleted, increases the number of connected components. The goal of this algorithm is to detect edges that are bridges in a graph.
community_detectionC++The Louvain method for community detection is a greedy method for finding communities with maximum modularity in a graph. Runs in O(nlogn) time.
cyclesC++Algorithm for detecting cycles on graphs.
distance_calculatorPythonModule for finding the geographical distance between two points defined with 'lng' and 'lat' coordinates.
degree_centralityC++The basic measurement of centrality that refers to the number of edges adjacent to a node.
graph_coloringPythonAlgorithm for assigning labels to the graph elements subject to certain constraints. In this form, it is a way of coloring the graph vertices such that no two adjacent vertices are of the same color.
katz_centralityC++Katz centrality is a centrality measurement that outputs a node's influence based on the number of shortest paths and their weighted length.
kmeansPythonAn algorithm for clustering given data.
max_flowPythonAn algorithm for finding a flow through a graph such that it is the maximum possible flow.
node_similarityPythonA module that contains similarity measures for calculating the similarity between two nodes.
pagerankC++Algorithm that yields the influence measurement based on the recursive information about the connected nodes influence.
set_coverPythonAn algorithm for finding the minimum cost subcollection of sets that covers all elements of a universe.
tspPythonAn algorithm for finding the shortest possible route that visits each vertex exactly once.
union_findPythonA module with an algorithm that enables the user to check whether the given nodes belong to the same connected component.
vrpPythonAlgorithm for finding the shortest route possible between the central depot and places to be visited. The algorithm can be solved with multiple vehicles that represent a visiting fleet.
weakly_connected_componentsC++A module that finds weakly connected components in a graph.

Streaming graph algorithms

betweenness_centrality_onlineC++A dynamic algorithm that updates exact betweenness centrality scores of nodes in evolving graphs. Suitable for graph streaming applications.
community_detection_onlineC++A dynamic community detection algorithm suitable for large-scale graphs based upon label propagation. Runs in O(m) time and has O(mn) space complexity.
katz_centrality_onlineC++Online implementation of the Katz centrality. Outputs the approximate result for Katz centrality while maintaining the order of rankings.
node2vec_onlinePythonAn algorithm for calculating node embeddings as new edges arrive.
pagerank_onlineC++A dynamic algorithm made for calculating PageRank in a graph streaming scenario.

Graph ML algorithms

link_prediction_with_gnnPythonModule for predicting links in the graph by using graph neural networks.
node-classification_with_gnnPythonGraph neural network-based node classification module
node2vecPythonAn algorithm for calculating node embeddings on static graph.
temporal_graph_networksPythonA graph neural network (GNN) algorithm that can learn to predict new edges and node labels from the graph structure and available node and edge features.

Utility algorithms

export_utilPythonA module for exporting the graph database in different formats (JSON).
graph_analyzerPythonThis Graph Analyzer query module offers insights about the stored graph or a subgraph.
json_utilPythonA module for loading JSON from a local file or remote address.
import_utilPythonA module for importing data from different formats (JSON).
rust_exampleRustExample of a basic module with input parameters forwarding, made in Rust.
uuid_generatorC++A module that generates a new universally unique identifier (UUID).


cugraphCUDACollection of NVIDIA GPU-powered algorithms integrated in Memgraph. Includes centrality measures, link analysis and graph clusterings.
igraphPythonA module that provides igraph integration with Memgraph and implements many igraph algorithms.
nxalgPythonA module that provides NetworkX integration with Memgraph and implements many NetworkX algorithms.

Create query modules

If you need some assistance in creating and running your own Python and C++ query modules How-to guides are here for you.

Learn about algorithms and their usage

There are so many algorithms to benefit from. Browse through them and see how they can be applied in use cases from various fields, such as bioinformatics or transportation.


Make MAGE even better by contributing your own algorithm implementations and ideas or reporting pesky bugs.

Browse through the Changelog

Want to know what's new in MAGE? Take a look at Changelog to see a list of new features.