Advanced algorithms

Advanced algorithms

If you require procedures designed to solve specific graph problems, there is a number of advanced algorithms available in Memgraph.

BFS, DFS, Weighted shortest path, All shortest paths are built-in deep path traversal algorithms you can run using their specific clauses.

For more algorithms, check the Memgraph Advanced Graph Extensions (MAGE) library. It is an open-source repository (opens in a new tab) that contains graph algorithms 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

Install MAGE

If you started Memgraph with the memgraph-platform or memgraph-mage Docker image, MAGE is already included and you can skip to step 3.

If you are using Linux, you can install MAGE from source.

The execution of graph algorithms can be accelerated with the GPU by using the Memgraph X NVIDIA cuGraph version of the library.

Load query modules

If your instance was already running when you installed MAGE, you need to execute the following query to load them:

CALL mg.load_all();

Check the list of available graph algorithms and query modules.

Call procedures

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

Memgraph compatibility

With changes in Memgraph API, MAGE started to track version numbers. Check out MAGE compatibility with Memgraph versions.

MAGE versionMemgraph version
>= 1.6>= 2.5.2
>= 1.4>= 2.4.0
>= 1.0>= 2.0.0
^0>= 1.4.0 <= 1.6.1

Custom query modules

You can create your own graph algorithms and query modules using C/C++ or Python, and contribute them to the MAGE library.