From 31cb0a76f361e738870866e693eeba437d2c1ad2 Mon Sep 17 00:00:00 2001 From: Vlasta Date: Mon, 14 Aug 2023 11:16:50 +0200 Subject: [PATCH 1/5] install-mage --- pages/advanced-algorithms.md | 72 --- pages/advanced-algorithms.mdx | 71 +++ pages/advanced-algorithms/install-mage.mdx | 513 +++++---------------- pages/custom-query-modules.mdx | 278 +++++++++++ pages/data-migration/csv.mdx | 8 +- 5 files changed, 479 insertions(+), 463 deletions(-) delete mode 100644 pages/advanced-algorithms.md create mode 100644 pages/advanced-algorithms.mdx diff --git a/pages/advanced-algorithms.md b/pages/advanced-algorithms.md deleted file mode 100644 index 13074990a..000000000 --- a/pages/advanced-algorithms.md +++ /dev/null @@ -1,72 +0,0 @@ -# Advanced algorithms - -**Memgraph Advanced Graph Extensions**, **MAGE** to friends, is an [**open-source -repository**](https://github.com/memgraph/mage) 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**](/advanced-algorithms/available-algorithms/available-algorithms) -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](/advanced-algorithms/install-mage) or by [building a Docker -image](/advanced-algorithms/install-mage) from the [official MAGE GitHub -repository](https://github.com/memgraph/mage). On Linux, you can also [install -MAGE from source](/advanced-algorithms/install-mage) 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](/custom-query-modules/manage-query-modules) to the -appropriate directory. - -### 3. Call procedures - -You are ready to [call procedures](/advanced-algorithms/run-algorithms) 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](/advanced-algorithms/available-algorithms). - -### Create query modules - -If you need some assistance in creating and running your own Python and C++ -query modules [How-to guides](/custom-query-modules/cpp) are here for you. - -### Learn about algorithms and their usage - -There are so many -[algorithms](/advanced-algorithms/available-algorithms/betweenness_centrality) -to benefit from. Browse through them and see how they can be applied in [use -cases](/use-cases/bioinformatics.md) from various fields, such as bioinformatics or -transportation. - -### Contribute - -Make MAGE even better by [contributing](/custom-query-modules/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](/release-notes) -to see a list of new features. - diff --git a/pages/advanced-algorithms.mdx b/pages/advanced-algorithms.mdx new file mode 100644 index 000000000..9b5763732 --- /dev/null +++ b/pages/advanced-algorithms.mdx @@ -0,0 +1,71 @@ +import { Steps } from 'nextra/components' + +# Advanced algorithms + +If you require procedures designed to solve specific graph problems, check the +**Memgraph Advanced Graph Extensions** (**MAGE**) library. It is an +[**open-source repository**](https://github.com/memgraph/mage) 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**](/advanced-algorithms/available-algorithms/available-algorithms) 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 + + + +### 1. 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. + +The execution of graph algorithms can be accelerated with the GPU, by using the +[Memgraph X NVIDIA cuGraph](/advanced-algorithms/install-mage) version of the library. + +If you are using Linux, you can [install MAGE from +source](/advanced-algorithms/install-mage). + +### 2. Load query modules + +To use certain procedures, first, you need to [load the query modules](/custom-query-modules/manage-query-modules) to the +appropriate directory. + +### 3. Call procedures + +You are ready to [call procedures](/advanced-algorithms/run-algorithms) 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 version | Memgraph version | +|--------------|-------------------| +| >= 1.6 | >= 2.5.2 | +| >= 1.4 | >= 2.4.0 | +| >= 1.0 | >= 2.0.0 | +| ^0 | >= 1.4.0 <= 1.6.1 | + + +## What to do next? + +### Check available graph algorithms and modules + +Utilize the [currently available query +modules](/advanced-algorithms/available-algorithms). + +### Create query modules + +You can create your own graph algorithms and query modules using C/C++ or +Python, and contribute them to the MAGE library. + + diff --git a/pages/advanced-algorithms/install-mage.mdx b/pages/advanced-algorithms/install-mage.mdx index c34e0eceb..c5cc47ea5 100644 --- a/pages/advanced-algorithms/install-mage.mdx +++ b/pages/advanced-algorithms/install-mage.mdx @@ -1,231 +1,144 @@ +import { Steps } from 'nextra/components' import { Callout } from 'nextra/components' # Install MAGE graph algorithm library - - -The **Docker Hub** and **Docker build** installation methods only require you to -[install Docker](https://docs.docker.com/get-docker/) while the **Build from -source on Linux** method requires the installation of additional dependencies. - - +Use MAGE with an instance installed within a [Docker container](#docker) or on +[Linux](#linux). -## Memgraph compatibility - -With changes in Memgraph API, MAGE started to track version numbers. Check out -the table below which will reveal MAGE compatibility with Memgraph versions. - -| MAGE version | Memgraph version | -|--------------|-------------------| -| >= 1.6 | >= 2.5.2 | -| >= 1.4 | >= 2.4.0 | -| >= 1.0 | >= 2.0.0 | -| ^0 | >= 1.4.0 <= 1.6.1 | +The execution of graph algorithms can be accelerated with the GPU, by using the +[Memgraph X NVIDIA +cuGraph](#mage--nvidia-cugraph) version of the +library. ## Docker -MAGE has prepared a Docker image on [**Docker -Hub**](https://hub.docker.com/r/memgraph/memgraph-mage) :whale: ready to be -pulled from -[memgraph/memgraph-mage](https://hub.docker.com/r/memgraph/memgraph-mage). - -Install MAGE: - -**1.** This is the only command you will need to make it run in your -environment: - -```shell -docker run -p 7687:7687 memgraph/memgraph-mage:latest -``` +If you [install Memgraph with Docker](/getting-started/install-memgraph/docker) +using `memgraph-platform` or `memgraph-mage` images the MAGE library is already +included and no additional installation is required to run the graph algorithms +on your data. -You can download a specific version of MAGE. For example, if you want to -download version `1.1`, you should run the following command: +You can download a specific version of MAGE -```shell -docker run -p 7687:7687 memgraph/memgraph-mage:1.1 -``` - -You can also download a MAGE image equipped for development inside of Docker -containers: +For example, if you want to download version `1.1`, you should run the following +command: ```shell -docker run -p 7687:7687 memgraph/memgraph-mage:1.1-dev +docker run -p 7687:7687 -name memgraph memgraph/memgraph-mage:1.1 ``` -By running this command, you will get an image with the following tools -installed: Python3, Rust, Clang, Make, and CMake. This way, you can copy files -to the container, build them inside and import query modules in Memgraph. - -If you want to develop your own query modules, be sure to check the [Development -process for MAGE with -Docker](https://github.com/memgraph/mage#developing-mage-with-docker). - -## Docker build +## Linux -This way, you will create a Docker image directly from the [MAGE Github -repository](https://github.com/memgraph/mage) and won't have to pull it from -Docker Hub. You can: +Follow the steps if you want to use the MAGE library with [installed Linux based +Memgraph package](https://memgraph.com/download). -- download a [specific release](https://github.com/memgraph/mage/releases) from - the MAGE repository or -- clone the [repository](https://github.com/memgraph/mage) for the latest - version. + -If you downloaded a specific release, skip the first step. +### Make sure the instance is not running -## Installing MAGE - -**1.** Download the MAGE source code from -**[GitHub](https://github.com/memgraph/mage)**: - -```shell -git clone --recurse-submodules https://github.com/memgraph/mage.git && cd mage -``` +Algorithms and query modules will be loaded into a Memgraph instance on startup +once you install MAGE, so make sure your instances are not running. -**2.** Build the **MAGE** tagged Docker image with the following command: +### Install dependencies -```shell -docker build -t memgraph-mage . -``` +To build from source, you will need: +- Python3 +- Make +- CMake +- Clang +- UUID +- [Rust and Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html) -**3.** Start Memgraph-MAGE with the following command: +### Set up the machine -```shell -docker run --rm -p 7687:7687 --name mage memgraph-mage -``` +Run the following commands: - - -Now you can query Memgraph with any of the querying platforms like [Memgraph -Lab](https://memgraph.com/product/lab) or -[mgconsole](https://github.com/memgraph/mgconsole). - -If you made any changes while the **MAGE** Docker container was running, you -would need to stop the Docker container and rebuild the whole image. If you -don't want to repeat these steps each time, be sure to check the [Development -process for MAGE with -Docker](https://github.com/memgraph/mage#developing-mage-with-docker). - - - -## Developing MAGE with Docker - -When developing your query module, you need to load it inside Memgraph running -inside the Docker container. You can do that by [rebuilding the whole MAGE -image](#1-rebuild-the-whole-mage-image) or by [building it inside the Docker -container](#2-build-inside-the-docker-container). - -### 1. Rebuild the whole MAGE image - -This command will trigger the rebuild of the whole Docker image. Make sure that -you have added Python requirements inside `python/requirements.txt` file. - -**1.** Firstly, do the build of the **MAGE** image: - -``` -docker build -t memgraph-mage . -``` - -**2.** Now, start `memgraph-mage` image with the following command and enjoy -**your** own **MAGE**: - -``` -docker run --rm -p 7687:7687 --name mage memgraph-mage +```bash +sudo apt-get update && apt-get install -y \ + libcurl4 `memgraph` \ + libpython${PY_VERSION} `memgraph` \ + libssl-dev `memgraph` \ + openssl `memgraph` \ + build-essential `mage-memgraph` \ + cmake `mage-memgraph` \ + curl `mage-memgraph` \ + g++ `mage-memgraph` \ + python3 `mage-memgraph` \ + python3-pip `mage-memgraph` \ + python3-setuptools `mage-memgraph` \ + python3-dev `mage-memgraph` \ + clang `mage-memgraph` \ + git `mage-memgraph` \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ``` -### 2. Build inside the Docker container - -You can build a **MAGE** Docker image equipped for development. `Rust`, `Clang`, -`Python3-pip`, and everything else necessary for development will still be -inside the running container. This means that you can copy the **MAGE** -repository to the container and do the build inside the `mage` container. There -is no need to do the whole Docker image build again. +### Download the MAGE source code -**1.** To create `dev` **MAGE** image, run the following command: +Clone the [MAGE source code](https://github.com/memgraph/mage) from GitHub: ``` -docker build --target dev -t memgraph-mage:dev . +git clone https://github.com/memgraph/mage.git ``` -**2.** Then run the image with the following command: - -``` -docker run --rm -p 7687:7687 --name mage memgraph-mage:dev -``` -**3.** Next, copy the files inside the container and do the build: +### Run the `setup` script -**a)** First, you need to copy the files to the container named `mage` +Run the following command: +```shell +python3 setup build -p /usr/lib/memgraph/query_modules ``` -docker cp . mage:/mage/ -``` - -**b)** Then, you need to position yourself inside the container as root: - -``` -docker exec -u root -it mage /bin/bash -``` - - -Note: If you have done the build locally, make sure to delete the directory -`cpp/build` because you might be dealing with different `architectures` or -problems with `CMakeCache.txt`. To delete it, run: +The script will generate a `dist` directory with all the needed files. -`rm -rf cpp/build` +It will also copy the contents of the newly created `dist` directory to +`/usr/lib/memgraph/query_modules`. Memgraph loads algorithms and modules from +this directory. - +If something isn't installed properly, the `setup` script will stop the +installation process. If you have any questions, contact us on +[Discord](https://discord.gg/memgraph).** -**c)** After that, run build and copy `mage/dist` to -`/usr/lib/memgraph/query_modules`: +### Start a Memgraph instance -``` -python3 setup build -p /usr/lib/memgraph/query_modules/ -``` +Algorithms and query modules will be loaded into a Memgraph instance on startup -**d)** Everything should be ready, and you can run the following command to exit -the container: +If your instance was already running you will need to execute the following +query to load them: ``` -exit +CALL mg.load_all(); ``` - - -Note that query modules are loaded into Memgraph on startup, so if your instance -was already running, you would need to execute the following query inside one of -the [querying platforms](https://memgraph.com/docs/memgraph/connect-to-memgraph) -to load them: - -`CALL mg.load_all();` +If your changes are not loaded, make sure to restart the instance by running +`systemctl stop memgraph` and `systemctl start memgraph`. - + ## MAGE × NVIDIA cuGraph Follow this guide to install Memgraph with [**NVIDIA cuGraph**](https://github.com/rapidsai/cugraph) GPU-powered graph algorithms. -### Prerequisites - - +### Docker -To be able to run cuGraph analytics, make sure you have compatible -infrastructure first. The exact system requirements are available at the -[**NVIDIA RAPIDS site**](https://rapids.ai/start.html#requirements), and include -an NVIDIA Pascal (or better) GPU and up-to-date CUDA & NVIDIA drivers. + - +### Prerequisites -**Docker requirements :whale:** +To be able to run cuGraph analytics, make sure you have compatible +infrastructure. The exact system requirements are available at the [**NVIDIA +RAPIDS site**](https://rapids.ai/start.html#requirements), and include an NVIDIA +Pascal (or better) GPU and up-to-date CUDA & NVIDIA drivers. -If running MAGE × NVIDIA cuGraph in Docker, the following applies: +If you want to run MAGE × NVIDIA cuGraph in Docker, install: +- Docker - Official [**NVIDIA driver**](https://www.nvidia.com/download/index.aspx) for your operating system. - To run on NVIDIA-powered GPUs, RAPIDS requires Docker CE v19.03+ and @@ -235,226 +148,89 @@ If running MAGE × NVIDIA cuGraph in Docker, the following applies: [**nvidia-docker2**]() package. -**Local build requirements:** - -If building MAGE × NVIDIA cuGraph locally, these requirements apply (tested on -Ubuntu): +### Download the image from Docker Hub -- Official [**NVIDIA driver**](https://www.nvidia.com/download/index.aspx) for - your operating system. -- [**CMake**](https://cmake.org/) version above 3.20 -- [**NVIDIA CUDA developer toolkit**](https://developer.nvidia.com/cuda-toolkit) - – CUDA version 11.6 -- System dependencies: `libblas-dev`, `liblapack-dev`, `libboost-all-dev` -- [**NVIDIA NCCL communications library**](https://developer.nvidia.com/nccl) - -## Installing the Docker image from Docker Hub - -The simplest way of starting Memgraph with cuGraph GPU analytics is to download -the image from Docker Hub. Just pull the image, and get it running with these -simple commands: +Pull the image and run it: ```shell docker run --rm --gpus all -p 7687:7687 -p 7444:7444 memgraph/memgraph-mage:1.3-cugraph-22.02-cuda-11.5 ``` -Depending on your environment, different versions of MAGE/cuGraph/CUDA can be +Depending on your environment, different versions of MAGE-cuGraph-CUDA can be installed: ```shell docker run --gpus all -p 7687:7687 -p 7444:7444 memgraph/memgraph-mage:${MAGE_VERSION}-cugraph-${CUGRAPH_VERSION}-cuda-${CUDA_VERSION} ``` -To see the available versions, explore our Docker Hub organization and look for -the images tagged -[**memgraph-mage**](https://hub.docker.com/r/memgraph/memgraph-mage/tags). - - - -The development image with cuGraph support is not available yet. If you want to -develop cuGraph-powered query modules in Docker, do not hesitate to [contact -us](https://memgraph.com/community) about it. - - - -### Building MAGE with NVIDIA cuGraph locally with Docker - -1. Download the MAGE source code from - [GitHub](https://github.com/memgraph/mage): - - ```shell - git clone https://github.com/memgraph/mage.git && cd mage - ``` - -2. Build the **MAGE × cuGraph**-tagged Docker image: - - ```shell - docker build -f Dockerfile.cugraph -t memgraph-mage . - ``` - -3. Start Memgraph-MAGE with the following command: - ```shell - docker run --rm --gpus all -p 7687:7687 -p 7444:7444 --name mage memgraph-mage - ``` - - - -You can now query Memgraph from querying platforms such as [Memgraph -Lab](https://memgraph.com/product/lab) or -[mgconsole](https://github.com/memgraph/mgconsole). - -If you made any changes while the Docker container was running, you need to stop -the container and rebuild the image. For a workaround, check [Development -process for MAGE with -Docker](/installation/docker-build.md#developing-mage-with-docker). - - - -### Installing MAGE natively from the source - - - -Make sure you have installed all prerequisites and dependencies before building -the MAGE × NVIDIA cuGraph from source. - - - -1. Download the MAGE source code from - [**GitHub**](https://github.com/memgraph/mage) and run the `setup` script. It - will generate a `dist` directory with all the needed files: - ```shell - python3 setup build --gpu - ``` +To see the available versions, explore Memgraph's Docker Hub and search for the +images tagged [**memgraph-mage**](https://hub.docker.com/r/memgraph/memgraph-mage/tags). - - The `--gpu` flag enables building the cuGraph dependencies and creating the - shared library with cuGraph algorithms that are loaded into Memgraph. + - -2. Copy the contents of the newly created `dist` directory to - `/usr/lib/memgraph/query_modules`: +### Linux - +To use the MAGE × NVIDIA cuGraph with [installed Linux based Memgraph +package](https://memgraph.com/download) you need to install it natively from the +source - To speed the installation up, you can specify a path for the setup script to - copy the built executables: + - ```shell - python3 setup build -p /usr/lib/memgraph/query_modules --gpu - ``` - - - -3. Start Memgraph and enjoy MAGE × cuGraph! - - - - If your Memgraph instance was already running, execute the following query - inside one of the [**querying - platforms**](https://memgraph.com/docs/memgraph/connect-to-memgraph) to reload - the modules: - - ``` - CALL mg.load_all(); - ``` - - If the modules are still missing, restart the instance by running `systemctl - stop memgraph` and then `systemctl start memgraph`. - - For more about loading query modules, consult [**this - guide**](/usage/loading-modules.md). - - - - ## Install MAGE on Linux from source +### Prerequisites - This step is only suitable for Linux users as you need to [download and install -a Linux based Memgraph package](https://memgraph.com/download). To build from -source, you will need **Python3**, **Make**, **CMake**, **Clang**, **UUID** -and **Rust**. +To be able to run cuGraph analytics, make sure you have compatible +infrastructure. The exact system requirements are available at the [**NVIDIA +RAPIDS site**](https://rapids.ai/start.html#requirements), and include an NVIDIA +Pascal (or better) GPU and up-to-date CUDA & NVIDIA drivers. - +If building MAGE × NVIDIA cuGraph locally, these requirements apply (tested on +Ubuntu): -You should not build MAGE from source and import the modules into Memgraph -running in a Docker container. You would need to build MAGE inside the same -container where Memgraph is running due to the possibility of different -architectures on your local machine and the Docker container. If you need to -work with Docker, we have prepared a Docker image equipped for local -development. Make sure to check the [Docker -build](/installation/docker-build.md) or [Docker -Hub](/installation/docker-hub.md) guides. +If you want to build MAGE × NVIDIA cuGraph locally, install: - +- Official [**NVIDIA driver**](https://www.nvidia.com/download/index.aspx) for + your operating system. +- [**CMake**](https://cmake.org/) version above 3.20 +- [**NVIDIA CUDA developer toolkit**](https://developer.nvidia.com/cuda-toolkit) + – CUDA version 11.6 +- System dependencies: `libblas-dev`, `liblapack-dev`, `libboost-all-dev` +- [**NVIDIA NCCL communications library**](https://developer.nvidia.com/nccl) -## Installing MAGE +### Make sure the instance is not running -### Prerequisits +Algorithms and query modules will be loaded into a Memgraph instance on startup +once you install MAGE, so make sure your instances are not running. -To install MAGE from source, first [install Rust and Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html). +### Download the source code -Then set up the machine by running the following commands: +Download the MAGE source code from [**GitHub**](https://github.com/memgraph/mage): -```bash -sudo apt-get update && apt-get install -y \ - libcurl4 `memgraph` \ - libpython${PY_VERSION} `memgraph` \ - libssl-dev `memgraph` \ - openssl `memgraph` \ - build-essential `mage-memgraph` \ - cmake `mage-memgraph` \ - curl `mage-memgraph` \ - g++ `mage-memgraph` \ - python3 `mage-memgraph` \ - python3-pip `mage-memgraph` \ - python3-setuptools `mage-memgraph` \ - python3-dev `mage-memgraph` \ - clang `mage-memgraph` \ - git `mage-memgraph` \ - --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* ``` - -### Installation process -**1.** Download the MAGE source code from -**[GitHub](https://github.com/memgraph/mage)** and run the `setup` script. - -The script will generate a `dist` directory with all the needed files: - -```shell -python3 setup build -p /usr/lib/memgraph/query_modules +git clone https://github.com/memgraph/mage.git ``` -The command above will also copy the contents of the newly created `dist` directory to -`/usr/lib/memgraph/query_modules`. Memgraph loads query modules from this directory. - -**If something isn't installed properly, the `setup` script will stop the installation process. If you have any -questions, contact us on [Discord](https://discord.gg/memgraph).** - - - -Be sure you cloned the `mage` GitHub repository using the `--recurse-submodules` flag since it has incorporated Memgraph inside: +### Run the `setup` script +Run the script to generate a `dist` directory with all the needed files: ```shell -git clone --recurse-submodules https://github.com/memgraph/mage.git +python3 setup build -p /usr/lib/memgraph/query_modules --gpu ``` -if you didn't, you can run following command to update submodules: +It will also copy the contents of the newly created `dist` directory to +`/usr/lib/memgraph/query_modules`. -```shell -git submodule update --init --recursive -``` - +The `--gpu` flag enables building the cuGraph dependencies and creating the +shared library with cuGraph algorithms that are loaded into Memgraph. -**2.** Start Memgraph and enjoy **MAGE**! +### Start a Memgraph instance - -Query modules are loaded into Memgraph on startup, so if your instance -was already running you will need to execute the following query inside one of -[querying platforms](https://memgraph.com/docs/memgraph/connect-to-memgraph) to -load them: +Algorithms and query modules will be loaded into a Memgraph instance on startup + +If your instance was already running you will need to execute the following +query to load them: ``` CALL mg.load_all(); @@ -463,41 +239,4 @@ CALL mg.load_all(); If your changes are not loaded, make sure to restart the instance by running `systemctl stop memgraph` and `systemctl start memgraph`. -If you want to find out more about loading query modules, visit [this -guide](/usage/loading-modules.md). - - - -### Advanced configuration - -#### 1. Set a different `query_modules` directory - -The `setup` script can set your local `mage/dist` directory or **any** other -directory as the **default** one in the Memgraph configuration file (flag -`--query-modules-directory` defined in `/etc/memgraph/memgraph.conf`). There are -a few options: - -**1.** Set `` as the **default** one: - -``` -python3 setup modules_storage -p -``` - -This way Memgraph will be looking for query modules inside ``. - - - -Don't forget to copy the aforementioned files from `mage/dist` to -``. - - - -**2.** Set `/mage/dist` as the **default** one: - -``` -python3 setup modules_storage -``` - -If the **default** directory is `mage/dist` then you don't need to copy `*.so` -and `*.py` files from the `mage/dist` directory -to`/usr/lib/memgraph/query_modules` every time you run `build`. + \ No newline at end of file diff --git a/pages/custom-query-modules.mdx b/pages/custom-query-modules.mdx index e870a0044..a74abb7ea 100644 --- a/pages/custom-query-modules.mdx +++ b/pages/custom-query-modules.mdx @@ -117,4 +117,282 @@ to help you start developing your own modules. If you need an additional Python library not included with Memgraph, check out [the guide on how to install it](/custom-query-modules/manage-query-modules). + + +## Install MAGE + +You can also download a MAGE image equipped for development inside of Docker +containers: + +```shell +docker run -p 7687:7687 memgraph/memgraph-mage:1.1-dev +``` + +By running this command, you will get an image with the following tools +installed: Python3, Rust, Clang, Make, and CMake. This way, you can copy files +to the container, build them inside and import query modules in Memgraph. + +If you want to develop your own query modules, be sure to check the [Development +process for MAGE with +Docker](https://github.com/memgraph/mage#developing-mage-with-docker). + + +---- + +## This is something taken from Install MAGE that seems it's used for building custom query_modules + +## This is when building MAGE from source with Linux + + +Be sure you cloned the `mage` GitHub repository using the `--recurse-submodules` flag since it has incorporated Memgraph inside: + +```shell +git clone --recurse-submodules https://github.com/memgraph/mage.git +``` + +if you didn't, you can run following command to update submodules: + +```shell +git submodule update --init --recursive +``` + + + +**2.** Start Memgraph and enjoy **MAGE**! + + +Query modules are loaded into Memgraph on startup, so if your instance +was already running you will need to execute the following query inside one of +[querying platforms](https://memgraph.com/docs/memgraph/connect-to-memgraph) to +load them: + +``` +CALL mg.load_all(); +``` + +If your changes are not loaded, make sure to restart the instance by running +`systemctl stop memgraph` and `systemctl start memgraph`. + +If you want to find out more about loading query modules, visit [this +guide](/usage/loading-modules.md). + + + +### Advanced configuration + +#### 1. Set a different `query_modules` directory + +The `setup` script can set your local `mage/dist` directory or **any** other +directory as the **default** one in the Memgraph configuration file (flag +`--query-modules-directory` defined in `/etc/memgraph/memgraph.conf`). There are +a few options: + +**1.** Set `` as the **default** one: + +``` +python3 setup modules_storage -p +``` + +This way Memgraph will be looking for query modules inside ``. + + + +Don't forget to copy the aforementioned files from `mage/dist` to +``. + + + +**2.** Set `/mage/dist` as the **default** one: + +``` +python3 setup modules_storage +``` + +If the **default** directory is `mage/dist` then you don't need to copy `*.so` +and `*.py` files from the `mage/dist` directory +to`/usr/lib/memgraph/query_modules` every time you run `build`. + +## Docker build + +This way, you will create a Docker image directly from the [MAGE Github +repository](https://github.com/memgraph/mage) and won't have to pull it from +Docker Hub. You can: + +- download a [specific release](https://github.com/memgraph/mage/releases) from + the MAGE repository or +- clone the [repository](https://github.com/memgraph/mage) for the latest + version. + +If you downloaded a specific release, skip the first step. + +## Installing MAGE + +**1.** Download the MAGE source code from +**[GitHub](https://github.com/memgraph/mage)**: + +```shell +git clone --recurse-submodules https://github.com/memgraph/mage.git && cd mage +``` + +**2.** Build the **MAGE** tagged Docker image with the following command: + +```shell +docker build -t memgraph-mage . +``` + +**3.** Start Memgraph-MAGE with the following command: + +```shell +docker run --rm -p 7687:7687 --name mage memgraph-mage +``` + + + +Now you can query Memgraph with any of the querying platforms like [Memgraph +Lab](https://memgraph.com/product/lab) or +[mgconsole](https://github.com/memgraph/mgconsole). + +If you made any changes while the **MAGE** Docker container was running, you +would need to stop the Docker container and rebuild the whole image. If you +don't want to repeat these steps each time, be sure to check the [Development +process for MAGE with +Docker](https://github.com/memgraph/mage#developing-mage-with-docker). + + + +## Developing MAGE with Docker + +When developing your query module, you need to load it inside Memgraph running +inside the Docker container. You can do that by [rebuilding the whole MAGE +image](#1-rebuild-the-whole-mage-image) or by [building it inside the Docker +container](#2-build-inside-the-docker-container). + +### 1. Rebuild the whole MAGE image + +This command will trigger the rebuild of the whole Docker image. Make sure that +you have added Python requirements inside `python/requirements.txt` file. + +**1.** Firstly, do the build of the **MAGE** image: + +``` +docker build -t memgraph-mage . +``` + +**2.** Now, start `memgraph-mage` image with the following command and enjoy +**your** own **MAGE**: + +``` +docker run --rm -p 7687:7687 --name mage memgraph-mage +``` + +### 2. Build inside the Docker container + +You can build a **MAGE** Docker image equipped for development. `Rust`, `Clang`, +`Python3-pip`, and everything else necessary for development will still be +inside the running container. This means that you can copy the **MAGE** +repository to the container and do the build inside the `mage` container. There +is no need to do the whole Docker image build again. + +**1.** To create `dev` **MAGE** image, run the following command: + +``` +docker build --target dev -t memgraph-mage:dev . +``` + +**2.** Then run the image with the following command: + +``` +docker run --rm -p 7687:7687 --name mage memgraph-mage:dev +``` + +**3.** Next, copy the files inside the container and do the build: + +**a)** First, you need to copy the files to the container named `mage` + +``` +docker cp . mage:/mage/ +``` + +**b)** Then, you need to position yourself inside the container as root: + +``` +docker exec -u root -it mage /bin/bash +``` + + + +Note: If you have done the build locally, make sure to delete the directory +`cpp/build` because you might be dealing with different `architectures` or +problems with `CMakeCache.txt`. To delete it, run: + +`rm -rf cpp/build` + + + +**c)** After that, run build and copy `mage/dist` to +`/usr/lib/memgraph/query_modules`: + +``` +python3 setup build -p /usr/lib/memgraph/query_modules/ +``` + +**d)** Everything should be ready, and you can run the following command to exit +the container: + +``` +exit +``` + + + +Note that query modules are loaded into Memgraph on startup, so if your instance +was already running, you would need to execute the following query inside one of +the [querying platforms](https://memgraph.com/docs/memgraph/connect-to-memgraph) +to load them: + +`CALL mg.load_all();` + + + +## Memgraph X cuGraph + + + +The development image with cuGraph support is not available yet. If you want to +develop cuGraph-powered query modules in Docker, do not hesitate to [contact +us](https://memgraph.com/community) about it. + + + +### Building MAGE with NVIDIA cuGraph locally with Docker + +1. Download the MAGE source code from + [GitHub](https://github.com/memgraph/mage): + + ```shell + git clone https://github.com/memgraph/mage.git && cd mage + ``` + +2. Build the **MAGE × cuGraph**-tagged Docker image: + + ```shell + docker build -f Dockerfile.cugraph -t memgraph-mage . + ``` + +3. Start Memgraph-MAGE with the following command: + ```shell + docker run --rm --gpus all -p 7687:7687 -p 7444:7444 --name mage memgraph-mage + ``` + + + +You can now query Memgraph from querying platforms such as [Memgraph +Lab](https://memgraph.com/product/lab) or +[mgconsole](https://github.com/memgraph/mgconsole). + +If you made any changes while the Docker container was running, you need to stop +the container and rebuild the image. For a workaround, check [Development +process for MAGE with +Docker](/installation/docker-build.md#developing-mage-with-docker). + \ No newline at end of file diff --git a/pages/data-migration/csv.mdx b/pages/data-migration/csv.mdx index 33c41da94..b19514f7f 100644 --- a/pages/data-migration/csv.mdx +++ b/pages/data-migration/csv.mdx @@ -331,7 +331,7 @@ of a single label or relationships of a single type. All files have a header. ### Download the files - - [`people_nodes.csv`](https://public-assets.memgraph.com/import-data/load-csv-cypher/multiple-types-nodes/people_nodes.csv) is used to create nodes labeled `:Person`.
The file contain the following data: + - [`people_nodes.csv`](https://public-assets.memgraph.com/import-data/load-csv-cypher/multiple-types-nodes/people_nodes.csv) is used to create nodes labeled `:Person`.
The file contains the following data: ```csv id,name,age,city 100,Daniel,30,London @@ -340,7 +340,7 @@ of a single label or relationships of a single type. All files have a header. 103,Mia,25,Zagreb 104,Lucy,21,Paris ``` -- [`restaurants_nodes.csv`](https://public-assets.memgraph.com/import-data/load-csv-cypher/multiple-types-nodes/restaurants_nodes.csv) is used to create nodes labeled `:Resturants`.
The file contain the following data: +- [`restaurants_nodes.csv`](https://public-assets.memgraph.com/import-data/load-csv-cypher/multiple-types-nodes/restaurants_nodes.csv) is used to create nodes labeled `:Resturants`.
The file contains the following data: ```csv id,name,menu 200,Mc Donalds,Fries;BigMac;McChicken;Apple Pie @@ -349,7 +349,7 @@ of a single label or relationships of a single type. All files have a header. 203,Dominos,Pepperoni Pizza;Double Dish Pizza;Cheese filled Crust ``` -- [`people_relationships.csv`](https://public-assets.memgraph.com/import-data/load-csv-cypher/multiple-types-nodes/people_relationships.csv) is used to connect people with the `:IS_FRIENDS_WITH` relationship.
The file contain the following data: +- [`people_relationships.csv`](https://public-assets.memgraph.com/import-data/load-csv-cypher/multiple-types-nodes/people_relationships.csv) is used to connect people with the `:IS_FRIENDS_WITH` relationship.
The file contains the following data: ```csv first_person,second_person,met_in 100,102,2014 @@ -360,7 +360,7 @@ of a single label or relationships of a single type. All files have a header. 101,102,2017 100,103,2001 ``` -- [`restaurants_relationships.csv`](https://public-assets.memgraph.com/import-data/load-csv-cypher/multiple-types-nodes/restaurants_relationships.csv) is used to connect people with restaurants using the `:ATE_AT` relationship.
The file contain the following data: +- [`restaurants_relationships.csv`](https://public-assets.memgraph.com/import-data/load-csv-cypher/multiple-types-nodes/restaurants_relationships.csv) is used to connect people with restaurants using the `:ATE_AT` relationship.
The file contains the following data: ```csv PERSON_ID,REST_ID,liked 100,200,true From ca2592a65cc28122904e8956b4bddc5c354205a4 Mon Sep 17 00:00:00 2001 From: Vlasta Date: Mon, 14 Aug 2023 14:03:56 +0200 Subject: [PATCH 2/5] other-pages --- pages/advanced-algorithms.mdx | 77 ++++--- pages/advanced-algorithms/_meta.json | 2 +- .../available-algorithms.md | 90 +++++++- .../built-in-graph-algorithms.mdx | 9 +- pages/advanced-algorithms/install-mage.mdx | 25 +-- pages/advanced-algorithms/run-algorithms.mdx | 206 ++++++++---------- pages/advanced-algorithms/utilize-networkx.md | 102 ++++++--- .../manage-query-modules.mdx | 72 ++++++ 8 files changed, 381 insertions(+), 202 deletions(-) diff --git a/pages/advanced-algorithms.mdx b/pages/advanced-algorithms.mdx index 9b5763732..1c5915a41 100644 --- a/pages/advanced-algorithms.mdx +++ b/pages/advanced-algorithms.mdx @@ -2,44 +2,59 @@ import { Steps } from 'nextra/components' # Advanced algorithms -If you require procedures designed to solve specific graph problems, check the -**Memgraph Advanced Graph Extensions** (**MAGE**) library. It is an -[**open-source repository**](https://github.com/memgraph/mage) 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**](/advanced-algorithms/available-algorithms/available-algorithms) 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. +If you require procedures designed to solve specific graph problems, there is a +number of advanced algorithms available in Memgraph. + +[BFS](/advanced-algorithms/built-in-graph-algorithms#breadth-first-search), +[DSF](/advanced-algorithms/built-in-graph-algorithms#depth-first-search), [Weighted shortest +path](/advanced-algorithms/built-in-graph-algorithms#weighted-shortest-path), +[All shortest +paths](/advanced-algorithms/built-in-graph-algorithms#all-shortest-paths) are +built-in 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](https://github.com/memgraph/mage) +that contains [graph algorithms](/advanced-algorithms/available-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 -### 1. Install MAGE +### 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. -The execution of graph algorithms can be accelerated with the GPU, by using the -[Memgraph X NVIDIA cuGraph](/advanced-algorithms/install-mage) version of the library. - If you are using Linux, you can [install MAGE from -source](/advanced-algorithms/install-mage). +source](/advanced-algorithms/install-mage#linux). + +The execution of graph algorithms can be accelerated with the GPU by using the +[Memgraph X NVIDIA cuGraph](/advanced-algorithms/install-mage#mage--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: -### 2. Load query modules +``` +CALL mg.load_all(); +``` -To use certain procedures, first, you need to [load the query modules](/custom-query-modules/manage-query-modules) to the -appropriate directory. +Check [the list](/advanced-algorithms/available-algorithms) of available graph +algorithms and query modules. -### 3. Call procedures +### Call procedures -You are ready to [call procedures](/advanced-algorithms/run-algorithms) within queries and tackle that graph analytics -problem that's been keeping you awake. +You are ready to [call procedures](/advanced-algorithms/run-algorithms) within +queries and tackle that graph analytics problem that's been keeping you awake. @@ -56,16 +71,10 @@ MAGE compatibility with Memgraph versions. | ^0 | >= 1.4.0 <= 1.6.1 | -## What to do next? - -### Check available graph algorithms and modules - -Utilize the [currently available query -modules](/advanced-algorithms/available-algorithms). - -### Create query modules +## 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. +You can [create your own graph algorithms](/custom-query-modules) and query +modules using C/C++ or Python, and +[contribute](/custom-query-modules/contribute) them to the MAGE library. diff --git a/pages/advanced-algorithms/_meta.json b/pages/advanced-algorithms/_meta.json index 1e5276350..df8213a16 100644 --- a/pages/advanced-algorithms/_meta.json +++ b/pages/advanced-algorithms/_meta.json @@ -1,7 +1,7 @@ { + "available-algorithms": "Available algorithms", "built-in-graph-algorithms": "Built-in graph algorithms", "install-mage": "Install MAGE", - "available-algorithms": "Available algorithms", "run-algorithms": "Run algorithms", "utilize-networkx": "Utilize NetworkX" } diff --git a/pages/advanced-algorithms/available-algorithms.md b/pages/advanced-algorithms/available-algorithms.md index a03722d0b..72e187d60 100644 --- a/pages/advanced-algorithms/available-algorithms.md +++ b/pages/advanced-algorithms/available-algorithms.md @@ -1,5 +1,89 @@ -# Algorithms avaliable in the MAGE library +# Available advanced algorithms -import MageSpells from '../../mage/templates/_mage_spells.mdx'; +If you require procedures designed to solve specific graph problems, there is a +number of advanced algorithms available in Memgraph. - \ No newline at end of file +Some algorithms are built in, and others are available in the [MAGE graph +library](/advanced-algorithms/install-mage). + +## Built-in algorithms + +| Algorithms | Lang | Description | +| -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [Depth-first search](/advanced-algorithms/built-in-graph-algortihms#depth-first-search) | C++ | An algorithm for traversing through a graph starting based on nodes' depth (distance from the source node). | +| [Breadth-first search](/advanced-algorithms/built-in-graph-algortihms#breadth-first-search) | C++ | An algorithm for traversing through a graph starting based on nodes' breadth (distance from the source node). | +| [Weighted shortest path](/advanced-algorithms/built-in-graph-algortihms#weighted-shortest-path) | C++ | The weighted shortest path problem is the problem of finding a path between two nodes in a graph such that the sum of the weights of relationships connecting nodes, or the sum of the weight of some node property on the path, is minimized. | +| [All shortest paths](/advanced-algorithms/built-in-graph-algortihms#all-shortest-paths) | C++ | Finding all shortest paths is an expansion of the weighted shortest paths problem. The goal of finding the shortest path is obtaining any minimum sum of weights on the path from one node to the other. | + +## Traditional graph algorithms + +| Algorithms | Lang | Description | +| -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [betweenness_centrality](/advanced-algorithms/available-algorithms/betweenness_centrality) | C++ | 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_components](/advanced-algorithms/available-algorithms/biconnected_components) | C++ | 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_matching](/advanced-algorithms/available-algorithms/bipartite_matching) | C++ | 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. | +| [bridges](/advanced-algorithms/available-algorithms/bridges) | C++ | 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_detection](/advanced-algorithms/available-algorithms/community_detection) | C++ | The Louvain method for community detection is a greedy method for finding communities with maximum modularity in a graph. Runs in _O_(*n*log*n*) time. | +| [cycles](/advanced-algorithms/available-algorithms/cycles) | C++ | Algorithm for detecting cycles on graphs. | +| [distance_calculator](/advanced-algorithms/available-algorithms/distance_calculator) | C++ | Module for finding the geographical distance between two points defined with 'lng' and 'lat' coordinates. | +| [degree_centrality](/advanced-algorithms/available-algorithms/degree_centrality) | C++ | The basic measurement of centrality that refers to the number of edges adjacent to a node. | +| [graph_coloring](/advanced-algorithms/available-algorithms/graph_coloring) | Python | Algorithm 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_centrality](/advanced-algorithms/available-algorithms/katz_centrality) | C++ | Katz centrality is a centrality measurement that outputs a node's influence based on the number of shortest paths and their weighted length. | +| [kmeans](/advanced-algorithms/available-algorithms/kmeans) | Python | An algorithm for clustering given data. | +| [max_flow](/advanced-algorithms/available-algorithms/max_flow) | Python | An algorithm for finding a flow through a graph such that it is the maximum possible flow. | +| [node_similarity](/advanced-algorithms/available-algorithms/node_similarity) | C++ | A module that contains similarity measures for calculating the similarity between two nodes. | +| [pagerank](/advanced-algorithms/available-algorithms/pagerank) | C++ | Algorithm that yields the influence measurement based on the recursive information about the connected nodes influence. | +| [set_cover](/advanced-algorithms/available-algorithms/set_cover) | Python | An algorithm for finding the minimum cost subcollection of sets that covers all elements of a universe. | +| [tsp](/advanced-algorithms/available-algorithms/tsp) | Python | An algorithm for finding the shortest possible route that visits each vertex exactly once. | +| [union_find](/advanced-algorithms/available-algorithms/union_find) | Python | A module with an algorithm that enables the user to check whether the given nodes belong to the same connected component. | +| [vrp](/advanced-algorithms/available-algorithms/vrp) | Python | Algorithm 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_components](/advanced-algorithms/available-algorithms/weakly_connected_components) | C++ | A module that finds weakly connected components in a graph. | + + +## Streaming graph algorithms + +| Algorithms | Lang | Description | +| -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [betweenness_centrality_online](/advanced-algorithms/available-algorithms/betweenness_centrality_online) | C++ | A dynamic algorithm that updates exact betweenness centrality scores of nodes in evolving graphs. Suitable for graph streaming applications. | +| [community_detection_online](/advanced-algorithms/available-algorithms/community_detection_online) | C++ | 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_online](/advanced-algorithms/available-algorithms/katz_centrality_online) | C++ | Online implementation of the Katz centrality. Outputs the approximate result for Katz centrality while maintaining the order of rankings. | +| [node2vec_online](/advanced-algorithms/available-algorithms/node2vec_online) | Python | An algorithm for calculating node embeddings as new edges arrive. | +| [pagerank_online](/advanced-algorithms/available-algorithms/pagerank_online) | C++ | A dynamic algorithm made for calculating PageRank in a graph streaming scenario. | + + +## Graph ML algorithms + +| Algorithms | Lang | Description | +| -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [link_prediction_with_gnn](/advanced-algorithms/available-algorithms/gnn_link_prediction) | Python | Module for predicting links in the graph by using graph neural networks. | +| [node-classification_with_gnn](/advanced-algorithms/available-algorithms/gnn_node_classification)| Python | Graph neural network-based node classification module | +| [node2vec](/advanced-algorithms/available-algorithms/node2vec) | Python | An algorithm for calculating node embeddings on static graph. | +| [temporal_graph_networks](/advanced-algorithms/available-algorithms/temporal_graph_networks) | Python | A 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 + +| Algorithms | Lang | Description | +| -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [conditional_execution](/advanced-algorithms/available-algorithms/conditional_execution) | C++ | Define conditions not expressible in Cypher and and use them to control query execution. | +| [export_util](/advanced-algorithms/available-algorithms/export_util) | Python | A module for exporting the graph database in different formats (JSON). | +| [graph_analyzer](/advanced-algorithms/available-algorithms/graph_analyzer) | Python | This Graph Analyzer query module offers insights about the stored graph or a subgraph. | +| [graph_util](/advanced-algorithms/available-algorithms/graph_util) | C++ | A module with common graph algorithms and graph manipulation utilities | +| [import_util](/advanced-algorithms/available-algorithms/import_util) | Python | A module for importing data from different formats (JSON). | +| [json_util](/advanced-algorithms/available-algorithms/json_util) | Python | A module for loading JSON from a local file or remote address. | +| [llm_util](/advanced-algorithms/available-algorithms/llm_util) | Python | A module that contains procedures describing graphs in a format best suited for large language models (LLMs). | +| [meta_util](/advanced-algorithms/available-algorithms/meta_util) | Python | A module that contains procedures describing graphs on a meta-level. | +| [migrate](/advanced-algorithms/available-algorithms/migrate) | Python | A module that can access data from a MySQL, SQL Server or Oracle database. | +| [periodic](/advanced-algorithms/available-algorithms/periodic) | C++ | A module containing procedures for periodically running difficult and/or memory/time consuming queries. | +| rust_example | Rust | Example of a basic module with input parameters forwarding, made in Rust. | +| [uuid_generator](/advanced-algorithms/available-algorithms/uuid_generator) | C++ | A module that generates a new universally unique identifier (UUID). | + + +## Integrations + +| Algorithms | Lang | Description | +| -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [cugraph](/mage/query-modules/cuda/cugraph) | CUDA | Collection of NVIDIA GPU-powered algorithms integrated in Memgraph. Includes centrality measures, link analysis and graph clusterings. | +| [elasticsearch](/advanced-algorithms/available-algorithms/elasticsearch_synchronization) | Python | A module used for synchronizing Memgraph and Elasticsearch. | +| [igraph](/advanced-algorithms/available-algorithms/igraphalg) | Python | A module that provides igraph integration with Memgraph and implements many igraph algorithms. | +| [nxalg](/advanced-algorithms/available-algorithms/nxalg) | Python | A module that provides NetworkX integration with Memgraph and implements many NetworkX algorithms. | diff --git a/pages/advanced-algorithms/built-in-graph-algorithms.mdx b/pages/advanced-algorithms/built-in-graph-algorithms.mdx index 93646362c..9a35e3cb9 100644 --- a/pages/advanced-algorithms/built-in-graph-algorithms.mdx +++ b/pages/advanced-algorithms/built-in-graph-algorithms.mdx @@ -20,10 +20,11 @@ Europe backpacking dataset, or adjust them to the dataset of your choice. Memgraph has a lot more graph algorithms to offer besides these three, and they -are all a part of [MAGE](/mage) - Memgraph Advanced Graph Extensions, an -open-source repository that contains graph algorithms and modules written in the -form of query modules that can be used to tackle the most interesting and -challenging graph analytics problems. Check the [full list of algorithms](/mage/algorithms). +are all a part of [MAGE](/advanced-algorithms/install-mage) - Memgraph Advanced +Graph Extensions, an open-source repository that contains graph algorithms and +modules written in the form of query modules that can be used to tackle the most +interesting and challenging graph analytics problems. Check the [full list of +algorithms](/advanced-algorithms/available-algorithms). diff --git a/pages/advanced-algorithms/install-mage.mdx b/pages/advanced-algorithms/install-mage.mdx index c5cc47ea5..669b66f39 100644 --- a/pages/advanced-algorithms/install-mage.mdx +++ b/pages/advanced-algorithms/install-mage.mdx @@ -34,7 +34,7 @@ docker run -p 7687:7687 -name memgraph memgraph/memgraph-mage:1.1 ## Linux Follow the steps if you want to use the MAGE library with [installed Linux based -Memgraph package](https://memgraph.com/download). +Memgraph package](/getting-started/install-memgraph). @@ -102,7 +102,7 @@ this directory. If something isn't installed properly, the `setup` script will stop the installation process. If you have any questions, contact us on -[Discord](https://discord.gg/memgraph).** +**[Discord](https://discord.gg/memgraph).** ### Start a Memgraph instance @@ -120,13 +120,11 @@ If your changes are not loaded, make sure to restart the instance by running -## MAGE × NVIDIA cuGraph +## MAGE × NVIDIA cuGraph on Docker Follow this guide to install Memgraph with [**NVIDIA cuGraph**](https://github.com/rapidsai/cugraph) GPU-powered graph algorithms. -### Docker - ### Prerequisites @@ -166,15 +164,13 @@ docker run --gpus all -p 7687:7687 -p 7444:7444 memgraph/memgraph-mage:${MAGE_VE To see the available versions, explore Memgraph's Docker Hub and search for the images tagged [**memgraph-mage**](https://hub.docker.com/r/memgraph/memgraph-mage/tags). - +## MAGE × NVIDIA cuGraph on Linux -### Linux - -To use the MAGE × NVIDIA cuGraph with [installed Linux based Memgraph -package](https://memgraph.com/download) you need to install it natively from the -source +To use the MAGE × [**NVIDIA cuGraph**](https://github.com/rapidsai/cugraph) with +[installed Linux based Memgraph package](https://memgraph.com/download) you need +to install it natively from the source @@ -221,9 +217,12 @@ python3 setup build -p /usr/lib/memgraph/query_modules --gpu It will also copy the contents of the newly created `dist` directory to `/usr/lib/memgraph/query_modules`. - The `--gpu` flag enables building the cuGraph dependencies and creating the -shared library with cuGraph algorithms that are loaded into Memgraph. +shared library with cuGraph algorithms that are loaded into Memgraph. + +If something isn't installed properly, the `setup` script will stop the +installation process. If you have any questions, contact us on +**[Discord](https://discord.gg/memgraph).** ### Start a Memgraph instance diff --git a/pages/advanced-algorithms/run-algorithms.mdx b/pages/advanced-algorithms/run-algorithms.mdx index ca6159a9d..e98b8a61c 100644 --- a/pages/advanced-algorithms/run-algorithms.mdx +++ b/pages/advanced-algorithms/run-algorithms.mdx @@ -2,84 +2,33 @@ import { Callout } from 'nextra/components' # Run algorithms -## Load procedures +Built-in algorithms ([BFS](/advanced-algorithms/built-in-graph-algorithms#BFS), +[DSF](/advanced-algorithms/built-in-graph-algorithms#DFS), [Weighted shortest +path](/advanced-algorithms/built-in-graph-algorithms#weighted-shortest-path), +[All shortest +paths](/advanced-algorithms/built-in-graph-algorithms#all-shortest-paths)) are +runned by using their designated clauses. -Once you start Memgraph, it will attempt to load query modules from all `*.so` -and `*.py` files from the default (`/usr/lib/memgraph/query_modules` and -`/var/lib/memgraph/internal_modules`) directories. +Running algorithms and procedures from query modules available in the MAGE +library are runned using the `CALL` clause. -MAGE modules are located at -`/usr/lib/memgraph/query_modules` and custom modules developed via Memgraph Lab at -`/var/lib/memgraph/internal_modules`. +## Run procedures from MAGE library -Memgraph can load query modules from additional directories, if their path is -added to the `--query-modules-directory` flag in the main configuration file -(`/etc/memgraph/memgraph.conf`) or supplied as a command-line parameter (e.g. -when using Docker). +The MAGE library containes query modules, each with their own procedures. -If you are supplying the additional directory as a parameter, do not forget to -include the path to `/usr/lib/memgraph/query_modules`, otherwise queries from -that directory will not be loaded when Memgraph starts. +To call the procedures within queries use the following Cypher syntax: - - -When working with Docker and `memgraph-platform` image, you should pass -configuration flags inside of environment variables, for example: - -```terminal -docker run -p 7687:7687 -p 7444:7444 -p 3000:3000 -e MEMGRAPH="--query-modules-directory=/usr/lib/memgraph/query_modules,/usr/lib/memgraph/my_modules" memgraph/memgraph-platform` -``` - -If you are working with `memgraph` or `memgraph-mage` images you should pass -configuration options like this: - -```terminal -docker run -p 7687:7687 -p 7444:7444 memgraph/memgraph --query-modules-directory=/usr/lib/memgraph/query_modules,/usr/lib/memgraph/my_modules -``` - - - -If a certain query module was added while Memgraph was already running, you need -to load it manually using the `mg.load("module_name")` procedure within a query: - -```cypher -CALL mg.load("py_example"); -``` - -If there is no response (no error message), the load was successful. - -If you want to reload all existing modules and load any newly added ones, use -`mg.load_all()`: - -```cypher -CALL mg.load_all(); -``` - -If there is no response (no error message), the load was successful. - -You can check if the query module has been loaded by using the `mg.procedures()` -procedure within a query: - -```cypher -CALL mg.procedures() YIELD *; -``` - -Once the MAGE query modules or any custom modules you developed have been -loaded into Memgraph, you can call them within queries using the following Cypher -syntax: - -```cypher +```cypher copy=false CALL module.procedure([optional parameter], arg1, "string_argument", ...) YIELD res1, res2, ...; ``` -## Run procedures - Every procedure has a first optional parameter and the rest of them depend on the procedure you are trying to call. The optional parameter must be result of the aggregation function -[`project()`](/cypher-manual/functions#aggregation-functions). If such a -parameter is provided, **all** operations will be executed on a projected graph. -Otherwise, you will work on the whole graph stored inside Memgraph. +[`project()`](/querying/functions#aggregation-functions). If such a +parameter is provided, **all** operations will be executed on a projected graph, +i.e., [a subgraph](#run-on-subgraph). Otherwise, you will work on the whole +graph stored inside Memgraph. Each procedure returns zero or more records, where each record contains named fields. The `YIELD` clause is used to select fields you are interested in or all @@ -88,9 +37,8 @@ The procedure will still run, but the record fields will not be stored in variables. If you are trying to `YIELD` fields that are not a part of the produced record, the query will result in an error. -Procedures can be standalone as in the example above, or a part of a larger -query when we want the procedure to work on data the query is -producing. +Procedures can be standalone, or a part of a larger query when we want the +procedure to work on data the query is producing. For example: @@ -115,28 +63,48 @@ using the `AS` sub-clause: ```cypher MATCH (result) CALL module.procedure(42) YIELD result AS procedure_result RETURN *; ``` +## Managing query modules from Memgraph Lab -## Run on subgraph +You can inspect query modules in [Memgraph Lab](/data-visualization) (v2.0 and +newer). Just navigate to **Query Modules**. -The following how-to guide will demonstrate how to run graph analytics on sub-graphs. A portion of the graph is projected from the whole network persisted in Memgraph, and algorithms are run on that portion of the graph. +![](/pages/advanced-algorithms/run-algorithms/memgraph_lab_query_modules.png) -If you need help with running MAGE modules and graph algorithms, check out the [how-to guide on that topic](/mage/how-to-guides/run-a-query-module.md). +There you can see all the loaded query modules, delete them, or see procedures +and transformations they define by clicking on the arrow icon. -### When not to run algorithms across the entire network and use the projection feature? -Executing any MAGE query module, the algorithm is executed on the whole network. -This is impractical in the following use cases: -- if the graph is heterogeneous, and you want to run the module only on specific labels -- if the graph is too large, and you only want to use the analytics to update only a portion of it -- the network contains multiple diverse data models and graphs, and running analytics on mixed graphs at once might yield unexpected results +By expanding procedures you can receive information about the procedure's +signature, input and output variables and their data type, as well as the `CALL` +query you can run directly from the **Query Modules** view. + +![](/pages/advanced-algorithms/run-algorithms/memgraph_lab_query_modules_details.png) + +## Run procedures on subgraph + +When executing any MAGE procedure, the algorithm is executed on the whole +network. + +This can be impractical when: +- the graph is heterogeneous, and you want to run the module only on specific + labels, +- the graph is too large, and you only want to use the analytics to update only + a portion of it, +- the network contains multiple diverse data models and graphs, and running + analytics on mixed graphs at once might yield unexpected results. That is why Memgraph enables module execution on subgraphs and graph -projections. The insights yielded by graph algorithms can then affect only the necessary nodes in your graph, -making the data more consistent and up to its specifications. +projections. The insights yielded by graph algorithms can then affect only the +necessary nodes in the graph, making the data more consistent and up to its +specifications. + +[Built-in algorithms](/advanced-algorithms/built-in-graph-algorithms) cannot be +run on subgraphs. ### Available graph projections -Graph projection function in Memgraph is called [project()](/cypher-manual/functions#graph-projection-functions), -and it is used in the following way: +Graph projection function in Memgraph is called +[project()](/querying/functions#graph-projection-functions), and it is used +in the following way: ```cypher MATCH p=(n)-[r]->(m) @@ -144,11 +112,14 @@ WITH project(p) AS subgraph RETURN subgraph; ``` -The path is specified first which denotes source and target nodes as well as relationships connecting them. -The function `project` then constructs a subgraph out of all the generated paths. +The path is specified first which denotes source and target nodes as well as +relationships connecting them. The function `project` then constructs a subgraph +out of all the generated paths. -Because the matched pattern actually includes all the nodes and the relationships in the graph, the result of this query is a projection of the whole graph. -To isolate a certain part of the graph, constraints need to be added to either labels, edge types, or properties, like in the query below: +Because the matched pattern actually includes all the nodes and the +relationships in the graph, the result of this query is a projection of the +whole graph. To isolate a certain part of the graph, constraints need to be +added to either labels, edge types, or properties, like in the query below: ```cypher MATCH p=(n:SpecificLabel)-[r:REL_TYPE]->(m:SpecificLabel) @@ -156,23 +127,34 @@ WITH project(p) AS subgraph RETURN subgraph; ``` -The query above will return a subgraph of `SpecificLabel` nodes connected with the relationships of type `REL_TYPE`. +The query above will return a subgraph of `SpecificLabel` nodes connected with +the relationships of type `REL_TYPE`. ### Calling query modules on graph projections -If you want to run query modules on subgraphs, specify the projected graph as the first argument of the query module. +If you want to run query modules on subgraphs, specify the projected graph as +the first argument of the query module. ```cypher CALL module.procedure([optional graph parameter], argument1, argument2, ...) YIELD * RETURN *; ``` -If the optional graph projection parameter is not included as the first argument, -the query module will be executed on the whole graph. +If the optional graph projection parameter is not included as the first +argument, the query module will be executed on the whole graph. + +Example of creating a projection and executing a procedure on a subgraph: + +``` +MATCH p=(n:SpecificLabel)-[r:REL_TYPE]->(m:SpecificLabel) +WITH project(p) AS subgraph +CALL module.procedure(subgraph, argument1, argument2, ...) YIELD * RETURN *; +``` ### Practical example with Twitter influencers -In this practical example, PageRank algorithm will be executed on a fictional Twitter dataset. -PageRank execution is grouped by the Twitter hashtag, and each Tweet can have a different number of retweets. +In this practical example, PageRank algorithm will be executed on a fictional +Twitter dataset. PageRank execution is grouped by the Twitter hashtag, and each +Tweet can have a different number of retweets. ![](/pages/advanced-algorithms/run-algorithms/whole-graph.png) @@ -197,16 +179,18 @@ MATCH (n:Tweet {id: 4}) MERGE (n)<-[:RETWEETED]-(:Tweet {hashtag: "#christmas", #### Running PageRank on the whole network -To run the PageRank algorithms available in the MAGE library, use the following query: +To run the PageRank algorithms available in the MAGE library, use the following +query: ```cypher CALL pagerank.get() YIELD node, rank SET node.rank = rank; ``` -The PageRank algorithm will take into account all the nodes in the graph. -It doesn't really make sense to correlate tweets about World Cup with tweets about Christmas, -as they are thematically quite different and should be analyzed separately. +The PageRank algorithm will take into account all the nodes in the graph. It +doesn't really make sense to correlate tweets about World Cup with tweets about +Christmas, as they are thematically quite different and should be analyzed +separately. #### Running PageRank on a subgraph @@ -225,8 +209,11 @@ ORDER BY rank DESC; ![](/pages/advanced-algorithms/run-algorithms/christmas-subgraph.png) -The above query successfully updated the rank of the Christmas tweets only! Let's do the same -on the World Cup tweets by changing the value of the hashtag property: +The above query successfully updated the rank of the Christmas tweets only! + + +Let's do the same on the World Cup tweets by changing the value of the hashtag +property: ```cypher MATCH p=(n:Tweet {hashtag: "#WorldCup"})-[r]->(m) @@ -239,13 +226,13 @@ ORDER BY rank DESC; ![](/pages/advanced-algorithms/run-algorithms/world-cup-subgraph.png) -### Mapping costume procedure names to existing query procedures +## Mapping custom procedure names to existing query procedures If you want to replace procedure names your application calls without changing the application code, you can define the mapping of the old and new procedure names in a JSON file, then set the path to the files as the value of the `query-callable-mappings-path` [configuration -flag](/reference-guide/configuration.md). +flag](/configuration/configuration-settings.md). Example of a JSON file: @@ -256,24 +243,7 @@ Example of a JSON file: } ``` -## Managing query modules from Memgraph Lab - -You can inspect query modules in Memgraph Lab (v2.0 and newer). -Just navigate to **Query Modules**. - -![](/pages/advanced-algorithms/run-algorithms/memgraph_lab_query_modules.png) - -There you can see all the loaded query modules, delete them, or see procedures -and transformations they define by clicking on the arrow icon. - -By expanding procedures you can receive information about the procedure's -signature, input and output variables and their data type, as well as the `CALL` -query you can run directly from the **Query Modules** view. - -Custom modules developed via Memgraph Lab are located at -`/var/lib/memgraph/internal_modules`. -![](/pages/advanced-algorithms/run-algorithms/memgraph_lab_query_modules_details.png) ## Control procedure memory usage diff --git a/pages/advanced-algorithms/utilize-networkx.md b/pages/advanced-algorithms/utilize-networkx.md index d55589a52..8673c423e 100644 --- a/pages/advanced-algorithms/utilize-networkx.md +++ b/pages/advanced-algorithms/utilize-networkx.md @@ -1,92 +1,130 @@ # Utilize the NetworkX library with Memgraph -NetworkX is a Python package for the creation, manipulation, and study of the structure, -dynamics, and functions of complex networks. Memgraph has [**`nxalg`**](/docs/mage/query-modules/python/nxalg) query module, which is a wrapper around NetworkX graph algorithms. It also provides **[Graph Analyzer](/mage/query-modules/python/graph-analyzer)** query module, which utilizes the NetworkX library. Besides that, you can create a custom query module that uses the NetworkX library. Through this how-to guide, you can find out: +NetworkX is a Python package for the creation, manipulation, and study of the +structure, dynamics, and functions of complex networks. Memgraph has +[**`nxalg`**](/advanced-algorithms/available-algorithms/nxalg) query module, +which is a wrapper around NetworkX graph algorithms. It also provides **[Graph +Analyzer](/advanced-algorithms/available-algorithms/graph_analyzer)** query +module, which utilizes the NetworkX library. Besides that, you can create a +custom query module that uses the NetworkX library. Through this how-to guide, +you can find out: -- [**How to run NetworkX algorithms in Memgraph Lab**](#how-to-run-networkx-algorithms-in-memgraph-lab) -- [**How to implement custom NetworkX module**](#how-to-implement-custom-networkx-module) +- [**How to run NetworkX algorithms in Memgraph + Lab**](#how-to-run-networkx-algorithms-in-memgraph-lab) +- [**How to implement custom NetworkX + module**](#how-to-implement-custom-networkx-module) ## How to run NetworkX algorithms in Memgraph Lab -NetworkX algorithms are integrated into Memgraph as query modules inside Memgraph’s open-source graph extension library [MAGE](/docs/mage). Head over to the guide on [how to call MAGE procedures](/docs/mage/usage/calling-procedures) to find out how to call all Memgraph procedures, including those that utilize the NetworkX library. +NetworkX algorithms are integrated into Memgraph as query modules inside +Memgraph’s open-source graph extension library +[MAGE](/advanced-algorithms/install-mage). -This how-to guide will show one simple example of calling a NetworkX procedure in Memgraph's visual interface Memgraph Lab. +It is used within queries the same way all the other query modules from the MAGE +library are, [by using the `CALL` clause](/advanced-algorithms/run-algorithms). + +This how-to guide will show one simple example of calling a NetworkX procedure +in Memgraph's visual interface Memgraph Lab. ### 1. Connect to Memgraph -First, run Memgraph using the Memgraph Platform Docker image, which includes both the MAGE library and Memgraph Lab. -To run the image, open a command-line interpreter and run the following Docker command: +First, run Memgraph using the Memgraph Platform Docker image, which includes +both the MAGE library and Memgraph Lab. To run the image, open a command-line +interpreter and run the following Docker command: ``` docker run -it -p 7687:7687 -p 7444:7444 -p 3000:3000 memgraph/memgraph-platform:latest ``` -[Connect to Memgraph](/docs/memgraph-lab/connect-to-memgraph#connecting-to-memgraph) via Memgraph Lab which is running at `localhost:3000`. +Connect to Memgraph via [Memgraph Lab](/data-visualization) which is running at `localhost:3000`. -Check out the [installation guide](/docs/memgraph/installation) for other installation options. If you wish to avoid the installation, you can also use [Memgraph Cloud](/docs/memgraph-cloud/). +Check out the [installation guide](/getting-started/install-memgraph) for other +installation options. If you wish to avoid the installation, you can also use +[Memgraph Cloud](/getting-started/install-memgraph/memgraph-cloud). ### 2. Load the dataset -Head over to the **Datasets** section to load a dataset and load the **Europe backpacking dataset**. +Head over to the **Datasets** section to load a dataset and load the **Europe +backpacking dataset**. ![](/pages/advanced-algorithms/utilize-networkx/nxalg-how-to-1.png) ### 3. Run NetworkX algorithm -Once the dataset is loaded, go to the **Query Modules** section and search for `nxalg` module. Click on the arrow next to the module name to **view module details**. +Once the dataset is loaded, go to the **Query Modules** section and search for +`nxalg` module. Click on the arrow next to the module name to **view module +details**. ![](/pages/advanced-algorithms/utilize-networkx/nxalg-how-to-2.png) -The goal is to run the [`is_bipartite()`](/docs/mage/query-modules/python/nxalg#is_bipartite) procedure to check whether the graph is bipartite. +The goal is to run the +[`is_bipartite()`](/advanced-algorithms/available-algorithms/nxalg#is_bipartite) procedure +to check whether the graph is bipartite. ![](/pages/advanced-algorithms/utilize-networkx/nxalg-how-to-3.png) -Copy the query, go to the **Query Execution** tab and paste the query into the **Cypher Editor**: +Copy the query, go to the **Query Execution** tab and paste the query into the +**Cypher Editor**: ```cypher CALL nxalg.is_bipartite() YIELD is_bipartite; ``` -By clicking on the **Run Query** button, you can see that the Europe backpacking graph is not bipartite. +By clicking on the **Run Query** button, you can see that the Europe backpacking +graph is not bipartite. ![](/pages/advanced-algorithms/utilize-networkx/nxalg-how-to-4.png) -In the same way, you can run other procedures from the `nxalg` module and the procedures from the `graph_analyzer` module, which can be found in the **Query Modules** section. +In the same way, you can run other procedures from the `nxalg` module and the +procedures from the `graph_analyzer` module, which can be found in the **Query +Modules** section. ## How to implement custom NetworkX module in Memgraph Lab -Besides using already implemented modules, you can create your own module which utilizes the NetworkX library. -To learn how to implement a custom query module, head over to the [example of query module in Python](/docs/memgraph/reference-guide/query-modules/implement-custom-query-modules/custom-query-module-example#python-api). +Besides using already implemented modules, you can [create your own +module](/custom-query-modules/python) which utilizes the NetworkX library. -Since Memgraph is integrated with NetworkX, you can import NetworkX library inside Python code. This guide will show you how to create a new query module that utilizes the NetworkX library within Memgraph's visual interface Memgraph Lab. +Since Memgraph is integrated with NetworkX, you can import NetworkX library +inside Python code. This guide will show you how to create a new query module +that utilizes the NetworkX library within Memgraph's visual interface Memgraph +Lab. ### 1. Connect to Memgraph -First, run Memgraph using the Memgraph Platform Docker image, which includes both the MAGE library and Memgraph Lab. -To run the image, open a command-line interpreter and run the following Docker command: +First, run Memgraph using the Memgraph Platform Docker image, which includes +both the MAGE library and Memgraph Lab. To run the image, open a command-line +interpreter and run the following Docker command: ``` docker run -it -p 7687:7687 -p 7444:7444 -p 3000:3000 memgraph/memgraph-platform:latest ``` -[Connect to Memgraph](/docs/memgraph-lab/connect-to-memgraph#connecting-to-memgraph) via Memgraph Lab which is running at `localhost:3000`. +Connect to Memgraph via [Memgraph Lab](/data-visualization) which is running at +`localhost:3000`. -Check out the [installation guide](/docs/memgraph/installation) for other installation options. If you wish to avoid the installation, you can also use [Memgraph Cloud](/docs/memgraph-cloud/). +Check out the [installation guide](/getting-started/install-memgraph) for other +installation options. If you wish to avoid the installation, you can also use +[Memgraph Cloud](/getting-started/install-memgraph/memgraph-cloud). ### 2. Load the dataset -In the **Datasets** section, find and load the Karate club friendship network dataset. +In the **Datasets** section, find and load the Karate club friendship network +dataset. ![](/pages/advanced-algorithms/utilize-networkx/nxalg-how-to-5.png) ### 3. Implement a custom query module -Once the dataset is loaded, go to the **Query modules** section. The goal is to create a community detection algorithm that can partition a network into multiple communities with the help of the NetworkX library. Click on the **New Module** and type in the module name, e.g., `communities`. +Once the dataset is loaded, go to the **Query modules** section. The goal is to +create a community detection algorithm that can partition a network into +multiple communities with the help of the NetworkX library. Click on the **New +Module** and type in the module name, e.g., `communities`. ![](/pages/advanced-algorithms/utilize-networkx/nxalg-how-to-6.png) -There is a sample Python code on the next screen, inside the code editor. Select it, delete it and paste the following code: +There is a sample Python code on the next screen, inside the code editor. Select +it, delete it and paste the following code: ```python import mgp @@ -107,7 +145,10 @@ def detect( list(s) for s in next(communities_generator)]) ``` -In the above code we are creating a read procedure which creates a NetworkX DiGraph from the MemgraphDiGraph object which takes the existing graph from the database. After that, we run the Girvan-Newman community algorithm and return its results. +In the above code we are creating a read procedure which creates a NetworkX +DiGraph from the MemgraphDiGraph object which takes the existing graph from the +database. After that, we run the Girvan-Newman community algorithm and return +its results. Here is what the code looks like in the code editor: @@ -126,11 +167,14 @@ UNWIND communities AS community RETURN community; ``` -After you click on **Run Query**, you can see the result, which consists of two lists. Each list represents one community. +After you click on **Run Query**, you can see the result, which consists of two +lists. Each list represents one community. ![](/pages/advanced-algorithms/utilize-networkx/nxalg-how-to-8.png) ## Where to next? -If you want to learn more about using Memgraph with NetworkX, check out the [**Memgraph for NetworkX developers resources**](https://memgraph.com/memgraph-for-networkx?utm_source=networkx-guide&utm_medium=referral&utm_campaign=networkx_ppp&utm_term=docs%2Bhowtoutilize&utm_content=resources). If you are using GQLAlchemy to connect to Memgraph, learn [how to import NetworkX graph into Memgraph](/docs/gqlalchemy/how-to-guides/import-python-graphs#import-networkx-graph-into-memgraph). +If you want to learn more about using Memgraph with NetworkX, check out the +[**Memgraph for NetworkX developers +resources**](https://memgraph.com/memgraph-for-networkx?utm_source=networkx-guide&utm_medium=referral&utm_campaign=networkx_ppp&utm_term=docs%2Bhowtoutilize&utm_content=resources). diff --git a/pages/custom-query-modules/manage-query-modules.mdx b/pages/custom-query-modules/manage-query-modules.mdx index 8f881f3aa..b748b65d9 100644 --- a/pages/custom-query-modules/manage-query-modules.mdx +++ b/pages/custom-query-modules/manage-query-modules.mdx @@ -70,6 +70,78 @@ CALL mg.procedures() YIELD *; Built-in utility query module (`mg`) contains procedures that enable you to manage query modules files. + +### This is from advanced algorithms, check if there is anything new Here +## Load procedures + +Once you start Memgraph, it will attempt to load query modules from all `*.so` +and `*.py` files from the default (`/usr/lib/memgraph/query_modules` and +`/var/lib/memgraph/internal_modules`) directories. + +MAGE modules are located at +`/usr/lib/memgraph/query_modules` and custom modules developed via Memgraph Lab at +`/var/lib/memgraph/internal_modules`. + +Memgraph can load query modules from additional directories, if their path is +added to the `--query-modules-directory` flag in the main configuration file +(`/etc/memgraph/memgraph.conf`) or supplied as a command-line parameter (e.g. +when using Docker). + +If you are supplying the additional directory as a parameter, do not forget to +include the path to `/usr/lib/memgraph/query_modules`, otherwise queries from +that directory will not be loaded when Memgraph starts. + + + +When working with Docker and `memgraph-platform` image, you should pass +configuration flags inside of environment variables, for example: + +```terminal +docker run -p 7687:7687 -p 7444:7444 -p 3000:3000 -e MEMGRAPH="--query-modules-directory=/usr/lib/memgraph/query_modules,/usr/lib/memgraph/my_modules" memgraph/memgraph-platform` +``` + +If you are working with `memgraph` or `memgraph-mage` images you should pass +configuration options like this: + +```terminal +docker run -p 7687:7687 -p 7444:7444 memgraph/memgraph --query-modules-directory=/usr/lib/memgraph/query_modules,/usr/lib/memgraph/my_modules +``` + + + +If a certain query module was added while Memgraph was already running, you need +to load it manually using the `mg.load("module_name")` procedure within a query: + +```cypher +CALL mg.load("py_example"); +``` + +If there is no response (no error message), the load was successful. + +If you want to reload all existing modules and load any newly added ones, use +`mg.load_all()`: + +```cypher +CALL mg.load_all(); +``` + +If there is no response (no error message), the load was successful. + +You can check if the query module has been loaded by using the `mg.procedures()` +procedure within a query: + +```cypher +CALL mg.procedures() YIELD *; +``` + +Once the MAGE query modules or any custom modules you developed have been +loaded into Memgraph, you can call them within queries using the following Cypher +syntax: + +```cypher +CALL module.procedure([optional parameter], arg1, "string_argument", ...) YIELD res1, res2, ...; +``` + ## General procedures Here is the list of procedures from the `mg` query module that can be used with From b8cf6aa7a73347aa72e45947c0d5afe9b9a7f440 Mon Sep 17 00:00:00 2001 From: Vlasta Date: Mon, 14 Aug 2023 14:15:57 +0200 Subject: [PATCH 3/5] links --- pages/advanced-algorithms/available-algorithms.md | 10 +++++----- .../available-algorithms/gnn_link_prediction.mdx | 2 +- .../available-algorithms/gnn_node_classification.mdx | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pages/advanced-algorithms/available-algorithms.md b/pages/advanced-algorithms/available-algorithms.md index 72e187d60..ddd893c56 100644 --- a/pages/advanced-algorithms/available-algorithms.md +++ b/pages/advanced-algorithms/available-algorithms.md @@ -29,7 +29,7 @@ library](/advanced-algorithms/install-mage). | [degree_centrality](/advanced-algorithms/available-algorithms/degree_centrality) | C++ | The basic measurement of centrality that refers to the number of edges adjacent to a node. | | [graph_coloring](/advanced-algorithms/available-algorithms/graph_coloring) | Python | Algorithm 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_centrality](/advanced-algorithms/available-algorithms/katz_centrality) | C++ | Katz centrality is a centrality measurement that outputs a node's influence based on the number of shortest paths and their weighted length. | -| [kmeans](/advanced-algorithms/available-algorithms/kmeans) | Python | An algorithm for clustering given data. | +| [kmeans](/advanced-algorithms/available-algorithms/kmeans_clustering) | Python | An algorithm for clustering given data. | | [max_flow](/advanced-algorithms/available-algorithms/max_flow) | Python | An algorithm for finding a flow through a graph such that it is the maximum possible flow. | | [node_similarity](/advanced-algorithms/available-algorithms/node_similarity) | C++ | A module that contains similarity measures for calculating the similarity between two nodes. | | [pagerank](/advanced-algorithms/available-algorithms/pagerank) | C++ | Algorithm that yields the influence measurement based on the recursive information about the connected nodes influence. | @@ -55,10 +55,10 @@ library](/advanced-algorithms/install-mage). | Algorithms | Lang | Description | | -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [link_prediction_with_gnn](/advanced-algorithms/available-algorithms/gnn_link_prediction) | Python | Module for predicting links in the graph by using graph neural networks. | -| [node-classification_with_gnn](/advanced-algorithms/available-algorithms/gnn_node_classification)| Python | Graph neural network-based node classification module | +| [link_prediction with GNN](/advanced-algorithms/available-algorithms/gnn_link_prediction) | Python | Module for predicting links in the graph by using graph neural networks. | +| [node_classification with GNN](/advanced-algorithms/available-algorithms/gnn_node_classification)| Python | Graph neural network-based node classification module | | [node2vec](/advanced-algorithms/available-algorithms/node2vec) | Python | An algorithm for calculating node embeddings on static graph. | -| [temporal_graph_networks](/advanced-algorithms/available-algorithms/temporal_graph_networks) | Python | A 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. | +| [temporal_graph_networks](/advanced-algorithms/available-algorithms/tgn) | Python | A 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 @@ -83,7 +83,7 @@ library](/advanced-algorithms/install-mage). | Algorithms | Lang | Description | | -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [cugraph](/mage/query-modules/cuda/cugraph) | CUDA | Collection of NVIDIA GPU-powered algorithms integrated in Memgraph. Includes centrality measures, link analysis and graph clusterings. | +| [cugraph](/advanced-algorithms/available-algorithms/cugraph) | CUDA | Collection of NVIDIA GPU-powered algorithms integrated in Memgraph. Includes centrality measures, link analysis and graph clusterings. | | [elasticsearch](/advanced-algorithms/available-algorithms/elasticsearch_synchronization) | Python | A module used for synchronizing Memgraph and Elasticsearch. | | [igraph](/advanced-algorithms/available-algorithms/igraphalg) | Python | A module that provides igraph integration with Memgraph and implements many igraph algorithms. | | [nxalg](/advanced-algorithms/available-algorithms/nxalg) | Python | A module that provides NetworkX integration with Memgraph and implements many NetworkX algorithms. | diff --git a/pages/advanced-algorithms/available-algorithms/gnn_link_prediction.mdx b/pages/advanced-algorithms/available-algorithms/gnn_link_prediction.mdx index 72bb2851a..72baaff30 100644 --- a/pages/advanced-algorithms/available-algorithms/gnn_link_prediction.mdx +++ b/pages/advanced-algorithms/available-algorithms/gnn_link_prediction.mdx @@ -1,7 +1,7 @@ import { Callout } from 'nextra/components' import { Steps } from 'nextra/components' -# link_prediction_with_gnn +# link_prediction with GNN export const Highlight = ({children, color}) => ( ( Date: Mon, 14 Aug 2023 14:19:00 +0200 Subject: [PATCH 4/5] rust --- pages/advanced-algorithms/available-algorithms.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/advanced-algorithms/available-algorithms.md b/pages/advanced-algorithms/available-algorithms.md index ddd893c56..205b4149d 100644 --- a/pages/advanced-algorithms/available-algorithms.md +++ b/pages/advanced-algorithms/available-algorithms.md @@ -75,7 +75,7 @@ library](/advanced-algorithms/install-mage). | [meta_util](/advanced-algorithms/available-algorithms/meta_util) | Python | A module that contains procedures describing graphs on a meta-level. | | [migrate](/advanced-algorithms/available-algorithms/migrate) | Python | A module that can access data from a MySQL, SQL Server or Oracle database. | | [periodic](/advanced-algorithms/available-algorithms/periodic) | C++ | A module containing procedures for periodically running difficult and/or memory/time consuming queries. | -| rust_example | Rust | Example of a basic module with input parameters forwarding, made in Rust. | +| [rust_example](https://github.com/memgraph/mage/tree/main/rust/rsmgp-example) | Rust | Example of a basic module with input parameters forwarding, made in Rust. | | [uuid_generator](/advanced-algorithms/available-algorithms/uuid_generator) | C++ | A module that generates a new universally unique identifier (UUID). | From 5770e1b485787ff85a2ff02d2f6b6b4729b84608 Mon Sep 17 00:00:00 2001 From: Vlasta Date: Mon, 14 Aug 2023 14:24:59 +0200 Subject: [PATCH 5/5] formatting --- .../available-algorithms.md | 122 +++++++++--------- 1 file changed, 62 insertions(+), 60 deletions(-) diff --git a/pages/advanced-algorithms/available-algorithms.md b/pages/advanced-algorithms/available-algorithms.md index 205b4149d..97d1886c5 100644 --- a/pages/advanced-algorithms/available-algorithms.md +++ b/pages/advanced-algorithms/available-algorithms.md @@ -8,82 +8,84 @@ library](/advanced-algorithms/install-mage). ## Built-in algorithms -| Algorithms | Lang | Description | -| -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [Depth-first search](/advanced-algorithms/built-in-graph-algortihms#depth-first-search) | C++ | An algorithm for traversing through a graph starting based on nodes' depth (distance from the source node). | -| [Breadth-first search](/advanced-algorithms/built-in-graph-algortihms#breadth-first-search) | C++ | An algorithm for traversing through a graph starting based on nodes' breadth (distance from the source node). | -| [Weighted shortest path](/advanced-algorithms/built-in-graph-algortihms#weighted-shortest-path) | C++ | The weighted shortest path problem is the problem of finding a path between two nodes in a graph such that the sum of the weights of relationships connecting nodes, or the sum of the weight of some node property on the path, is minimized. | -| [All shortest paths](/advanced-algorithms/built-in-graph-algortihms#all-shortest-paths) | C++ | Finding all shortest paths is an expansion of the weighted shortest paths problem. The goal of finding the shortest path is obtaining any minimum sum of weights on the path from one node to the other. | +| Algorithms | Lang | Description | +| ----------------------------------------------------------------------------------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [Depth-first search](/advanced-algorithms/built-in-graph-algortihms#depth-first-search) | C++ | An algorithm for traversing through a graph starting based on nodes' depth (distance from the source node). | +| [Breadth-first search](/advanced-algorithms/built-in-graph-algortihms#breadth-first-search) | C++ | An algorithm for traversing through a graph starting based on nodes' breadth (distance from the source node). | +| [Weighted shortest path](/advanced-algorithms/built-in-graph-algortihms#weighted-shortest-path) | C++ | The weighted shortest path problem is the problem of finding a path between two nodes in a graph such that the sum of the weights of relationships connecting nodes, or the sum of the weight of some node property on the path, is minimized. | +| [All shortest paths](/advanced-algorithms/built-in-graph-algortihms#all-shortest-paths) | C++ | Finding all shortest paths is an expansion of the weighted shortest paths problem. The goal of finding the shortest path is obtaining any minimum sum of weights on the path from one node to the other. | ## Traditional graph algorithms -| Algorithms | Lang | Description | -| -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [betweenness_centrality](/advanced-algorithms/available-algorithms/betweenness_centrality) | C++ | 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_components](/advanced-algorithms/available-algorithms/biconnected_components) | C++ | 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_matching](/advanced-algorithms/available-algorithms/bipartite_matching) | C++ | 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. | -| [bridges](/advanced-algorithms/available-algorithms/bridges) | C++ | 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_detection](/advanced-algorithms/available-algorithms/community_detection) | C++ | The Louvain method for community detection is a greedy method for finding communities with maximum modularity in a graph. Runs in _O_(*n*log*n*) time. | -| [cycles](/advanced-algorithms/available-algorithms/cycles) | C++ | Algorithm for detecting cycles on graphs. | -| [distance_calculator](/advanced-algorithms/available-algorithms/distance_calculator) | C++ | Module for finding the geographical distance between two points defined with 'lng' and 'lat' coordinates. | -| [degree_centrality](/advanced-algorithms/available-algorithms/degree_centrality) | C++ | The basic measurement of centrality that refers to the number of edges adjacent to a node. | -| [graph_coloring](/advanced-algorithms/available-algorithms/graph_coloring) | Python | Algorithm 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_centrality](/advanced-algorithms/available-algorithms/katz_centrality) | C++ | Katz centrality is a centrality measurement that outputs a node's influence based on the number of shortest paths and their weighted length. | -| [kmeans](/advanced-algorithms/available-algorithms/kmeans_clustering) | Python | An algorithm for clustering given data. | -| [max_flow](/advanced-algorithms/available-algorithms/max_flow) | Python | An algorithm for finding a flow through a graph such that it is the maximum possible flow. | -| [node_similarity](/advanced-algorithms/available-algorithms/node_similarity) | C++ | A module that contains similarity measures for calculating the similarity between two nodes. | -| [pagerank](/advanced-algorithms/available-algorithms/pagerank) | C++ | Algorithm that yields the influence measurement based on the recursive information about the connected nodes influence. | -| [set_cover](/advanced-algorithms/available-algorithms/set_cover) | Python | An algorithm for finding the minimum cost subcollection of sets that covers all elements of a universe. | -| [tsp](/advanced-algorithms/available-algorithms/tsp) | Python | An algorithm for finding the shortest possible route that visits each vertex exactly once. | -| [union_find](/advanced-algorithms/available-algorithms/union_find) | Python | A module with an algorithm that enables the user to check whether the given nodes belong to the same connected component. | -| [vrp](/advanced-algorithms/available-algorithms/vrp) | Python | Algorithm 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_components](/advanced-algorithms/available-algorithms/weakly_connected_components) | C++ | A module that finds weakly connected components in a graph. | +| Algorithms | Lang | Description | +| ---------------------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [betweenness_centrality](/advanced-algorithms/available-algorithms/betweenness_centrality) | C++ | 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_components](/advanced-algorithms/available-algorithms/biconnected_components) | C++ | 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_matching](/advanced-algorithms/available-algorithms/bipartite_matching) | C++ | 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. | +| [bridges](/advanced-algorithms/available-algorithms/bridges) | C++ | 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. | +| [collections](/mage/query-modules/cpp/collections) | C++ | The collections module is a collection manipulation module that offers functions to work with lists in Cypher queries, allowing operations like filtering, sorting, and modification for efficient data handling. | +| [community_detection](/advanced-algorithms/available-algorithms/community_detection) | C++ | The Louvain method for community detection is a greedy method for finding communities with maximum modularity in a graph. Runs in _O_(*n*log*n*) time. | +| [cycles](/advanced-algorithms/available-algorithms/cycles) | C++ | Algorithm for detecting cycles on graphs. | +| [distance_calculator](/advanced-algorithms/available-algorithms/distance_calculator) | C++ | Module for finding the geographical distance between two points defined with 'lng' and 'lat' coordinates. | +| [degree_centrality](/advanced-algorithms/available-algorithms/degree_centrality) | C++ | The basic measurement of centrality that refers to the number of edges adjacent to a node. | +| [graph_coloring](/advanced-algorithms/available-algorithms/graph_coloring) | Python | Algorithm 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_centrality](/advanced-algorithms/available-algorithms/katz_centrality) | C++ | Katz centrality is a centrality measurement that outputs a node's influence based on the number of shortest paths and their weighted length. | +| [kmeans](/advanced-algorithms/available-algorithms/kmeans_clustering) | Python | An algorithm for clustering given data. | +| [map](/mage/query-modules/cpp/map) | C++ | The map module offers a versatile toolkit for manipulating collections of key-value pairs, enabling advanced data operations within a graph database context | +| [max_flow](/advanced-algorithms/available-algorithms/max_flow) | Python | An algorithm for finding a flow through a graph such that it is the maximum possible flow. | +| [node_similarity](/advanced-algorithms/available-algorithms/node_similarity) | C++ | A module that contains similarity measures for calculating the similarity between two nodes. | +| [pagerank](/advanced-algorithms/available-algorithms/pagerank) | C++ | Algorithm that yields the influence measurement based on the recursive information about the connected nodes influence. | +| [set_cover](/advanced-algorithms/available-algorithms/set_cover) | Python | An algorithm for finding the minimum cost subcollection of sets that covers all elements of a universe. | +| [tsp](/advanced-algorithms/available-algorithms/tsp) | Python | An algorithm for finding the shortest possible route that visits each vertex exactly once. | +| [union_find](/advanced-algorithms/available-algorithms/union_find) | Python | A module with an algorithm that enables the user to check whether the given nodes belong to the same connected component. | +| [vrp](/advanced-algorithms/available-algorithms/vrp) | Python | Algorithm 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_components](/advanced-algorithms/available-algorithms/weakly_connected_components) | C++ | A module that finds weakly connected components in a graph. | ## Streaming graph algorithms -| Algorithms | Lang | Description | -| -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [betweenness_centrality_online](/advanced-algorithms/available-algorithms/betweenness_centrality_online) | C++ | A dynamic algorithm that updates exact betweenness centrality scores of nodes in evolving graphs. Suitable for graph streaming applications. | -| [community_detection_online](/advanced-algorithms/available-algorithms/community_detection_online) | C++ | 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_online](/advanced-algorithms/available-algorithms/katz_centrality_online) | C++ | Online implementation of the Katz centrality. Outputs the approximate result for Katz centrality while maintaining the order of rankings. | -| [node2vec_online](/advanced-algorithms/available-algorithms/node2vec_online) | Python | An algorithm for calculating node embeddings as new edges arrive. | -| [pagerank_online](/advanced-algorithms/available-algorithms/pagerank_online) | C++ | A dynamic algorithm made for calculating PageRank in a graph streaming scenario. | +| Algorithms | Lang | Description | +| -------------------------------------------------------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [betweenness_centrality_online](/advanced-algorithms/available-algorithms/betweenness_centrality_online) | C++ | A dynamic algorithm that updates exact betweenness centrality scores of nodes in evolving graphs. Suitable for graph streaming applications. | +| [community_detection_online](/advanced-algorithms/available-algorithms/community_detection_online) | C++ | 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_online](/advanced-algorithms/available-algorithms/katz_centrality_online) | C++ | Online implementation of the Katz centrality. Outputs the approximate result for Katz centrality while maintaining the order of rankings. | +| [node2vec_online](/advanced-algorithms/available-algorithms/node2vec_online) | Python | An algorithm for calculating node embeddings as new edges arrive. | +| [pagerank_online](/advanced-algorithms/available-algorithms/pagerank_online) | C++ | A dynamic algorithm made for calculating PageRank in a graph streaming scenario. | ## Graph ML algorithms -| Algorithms | Lang | Description | -| -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [link_prediction with GNN](/advanced-algorithms/available-algorithms/gnn_link_prediction) | Python | Module for predicting links in the graph by using graph neural networks. | -| [node_classification with GNN](/advanced-algorithms/available-algorithms/gnn_node_classification)| Python | Graph neural network-based node classification module | -| [node2vec](/advanced-algorithms/available-algorithms/node2vec) | Python | An algorithm for calculating node embeddings on static graph. | -| [temporal_graph_networks](/advanced-algorithms/available-algorithms/tgn) | Python | A 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. | +| Algorithms | Lang | Description | +| ------------------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [link_prediction with GNN](/advanced-algorithms/available-algorithms/gnn_link_prediction) | Python | Module for predicting links in the graph by using graph neural networks. | +| [node_classification with GNN](/advanced-algorithms/available-algorithms/gnn_node_classification) | Python | Graph neural network-based node classification module | +| [node2vec](/advanced-algorithms/available-algorithms/node2vec) | Python | An algorithm for calculating node embeddings on static graph. | +| [temporal_graph_networks](/advanced-algorithms/available-algorithms/tgn) | Python | A 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 -| Algorithms | Lang | Description | -| -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [conditional_execution](/advanced-algorithms/available-algorithms/conditional_execution) | C++ | Define conditions not expressible in Cypher and and use them to control query execution. | -| [export_util](/advanced-algorithms/available-algorithms/export_util) | Python | A module for exporting the graph database in different formats (JSON). | -| [graph_analyzer](/advanced-algorithms/available-algorithms/graph_analyzer) | Python | This Graph Analyzer query module offers insights about the stored graph or a subgraph. | -| [graph_util](/advanced-algorithms/available-algorithms/graph_util) | C++ | A module with common graph algorithms and graph manipulation utilities | -| [import_util](/advanced-algorithms/available-algorithms/import_util) | Python | A module for importing data from different formats (JSON). | -| [json_util](/advanced-algorithms/available-algorithms/json_util) | Python | A module for loading JSON from a local file or remote address. | -| [llm_util](/advanced-algorithms/available-algorithms/llm_util) | Python | A module that contains procedures describing graphs in a format best suited for large language models (LLMs). | -| [meta_util](/advanced-algorithms/available-algorithms/meta_util) | Python | A module that contains procedures describing graphs on a meta-level. | -| [migrate](/advanced-algorithms/available-algorithms/migrate) | Python | A module that can access data from a MySQL, SQL Server or Oracle database. | -| [periodic](/advanced-algorithms/available-algorithms/periodic) | C++ | A module containing procedures for periodically running difficult and/or memory/time consuming queries. | -| [rust_example](https://github.com/memgraph/mage/tree/main/rust/rsmgp-example) | Rust | Example of a basic module with input parameters forwarding, made in Rust. | -| [uuid_generator](/advanced-algorithms/available-algorithms/uuid_generator) | C++ | A module that generates a new universally unique identifier (UUID). | +| Algorithms | Lang | Description | +| ---------------------------------------------------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------- | +| [conditional_execution](/advanced-algorithms/available-algorithms/conditional_execution) | C++ | Define conditions not expressible in Cypher and and use them to control query execution. | +| [export_util](/advanced-algorithms/available-algorithms/export_util) | Python | A module for exporting the graph database in different formats (JSON). | +| [graph_analyzer](/advanced-algorithms/available-algorithms/graph_analyzer) | Python | This Graph Analyzer query module offers insights about the stored graph or a subgraph. | +| [graph_util](/advanced-algorithms/available-algorithms/graph_util) | C++ | A module with common graph algorithms and graph manipulation utilities | +| [import_util](/advanced-algorithms/available-algorithms/import_util) | Python | A module for importing data from different formats (JSON). | +| [json_util](/advanced-algorithms/available-algorithms/json_util) | Python | A module for loading JSON from a local file or remote address. | +| [llm_util](/advanced-algorithms/available-algorithms/llm_util) | Python | A module that contains procedures describing graphs in a format best suited for large language models (LLMs). | +| [meta_util](/advanced-algorithms/available-algorithms/meta_util) | Python | A module that contains procedures describing graphs on a meta-level. | +| [migrate](/advanced-algorithms/available-algorithms/migrate) | Python | A module that can access data from a MySQL, SQL Server or Oracle database. | +| [periodic](/advanced-algorithms/available-algorithms/periodic) | C++ | A module containing procedures for periodically running difficult and/or memory/time consuming queries. | +| [rust_example](https://github.com/memgraph/mage/tree/main/rust/rsmgp-example) | Rust | Example of a basic module with input parameters forwarding, made in Rust. | +| [uuid_generator](/advanced-algorithms/available-algorithms/uuid_generator) | C++ | A module that generates a new universally unique identifier (UUID). | ## Integrations -| Algorithms | Lang | Description | -| -------------------------------------------------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| [cugraph](/advanced-algorithms/available-algorithms/cugraph) | CUDA | Collection of NVIDIA GPU-powered algorithms integrated in Memgraph. Includes centrality measures, link analysis and graph clusterings. | -| [elasticsearch](/advanced-algorithms/available-algorithms/elasticsearch_synchronization) | Python | A module used for synchronizing Memgraph and Elasticsearch. | -| [igraph](/advanced-algorithms/available-algorithms/igraphalg) | Python | A module that provides igraph integration with Memgraph and implements many igraph algorithms. | -| [nxalg](/advanced-algorithms/available-algorithms/nxalg) | Python | A module that provides NetworkX integration with Memgraph and implements many NetworkX algorithms. | +| Algorithms | Lang | Description | +| ---------------------------------------------------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------- | +| [cugraph](/advanced-algorithms/available-algorithms/cugraph) | CUDA | Collection of NVIDIA GPU-powered algorithms integrated in Memgraph. Includes centrality measures, link analysis and graph clusterings. | +| [elasticsearch](/advanced-algorithms/available-algorithms/elasticsearch_synchronization) | Python | A module used for synchronizing Memgraph and Elasticsearch. | +| [igraph](/advanced-algorithms/available-algorithms/igraphalg) | Python | A module that provides igraph integration with Memgraph and implements many igraph algorithms. | +| [nxalg](/advanced-algorithms/available-algorithms/nxalg) | Python | A module that provides NetworkX integration with Memgraph and implements many NetworkX algorithms. |