Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ jobs:
poetry install --all-extras
poe install-pyg-cpu
poe install-dgl
poe install-tfgnn
- name: Run Tests
run: |
export TF_USE_LEGACY_KERAS="1"
poetry run pytest -vvv -m "not slow and not ubuntu and not docker"
- name: Use the Upload Artifact GitHub Action
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -131,6 +133,8 @@ jobs:
run: |
poetry install --all-extras
poe install-pyg-cpu
poe install-tfgnn
export TF_USE_LEGACY_KERAS="1"
poetry run pytest -vvv -m "not slow and not ubuntu and not docker"
- name: Save Memgraph Logs
uses: actions/upload-artifact@v4
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ poetry install # No extras
poetry install -E arrow # Support for the CSV, Parquet, ORC and IPC/Feather/Arrow formats
poetry install -E dgl # DGL support (also includes torch)
poetry install -E docker # Docker support
poetry install -E tfgnn # TFGNN support
```

To run the tests, make sure you have an [active Memgraph instance](https://memgraph.com/docs/getting-started), and execute one of the following commands:
Expand All @@ -100,6 +101,7 @@ If you’ve installed only certain extras, it’s also possible to run their ass
poetry run pytest . -k "arrow"
poetry run pytest . -k "dgl"
poetry run pytest . -k "docker"
poetry run pytest . -k "tfgnn"
```

## Development (how to build)
Expand Down
12 changes: 10 additions & 2 deletions docs/how-to-guides/translators/export-python-graphs.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,20 @@ In this guide you will learn how to:
- [**Export data from Memgraph into DGL graph**](#import-dgl-graph-into-memgraph)

## General prerequisites
You need a running **Memgraph Platform instance**, which includes both the MAGE library and Memgraph Lab, a visual interface. To run the image, open a command-line interpreter and run the following Docker command:
You need **Memgraph Platform** running, which includes both the MAGE library and Memgraph Lab, a visual interface. To run it on Linux/macOS, run the following in your terminal:

```
docker run -it -p 7687:7687 -p 7444:7444 -p 3000:3000 memgraph/memgraph-platform:latest
curl https://install.memgraph.com | sh
```

To run it on Windows, execute the following command in the console:

```
iwr https://windows.memgraph.com | iex
```

The above command runs a script that downloads a Docker Compose file to your system, builds and starts `memgraph-mage` and `memgraph-lab` Docker services in two separate containers.

<details>
<summary>To export data from Memgraph, you first have to <b>create a graph in Memgraph</b>. To do that, expand this section and run the given Python script.</summary>

Expand Down
12 changes: 10 additions & 2 deletions docs/how-to-guides/translators/import-python-graphs.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,20 @@ In this guide you will learn how to:
- [**Import DGL graph into Memgraph**](#import-dgl-graph-into-memgraph)

## General prerequisites
You need a running **Memgraph Platform instance**, which includes both the MAGE library and Memgraph Lab, a visual interface. To run the image, open a command-line interpreter and run the following Docker command:
You need **Memgraph Platform** running, which includes both the MAGE library and Memgraph Lab, a visual interface. To run it on Linux/macOS, run the following in your terminal:

```
docker run -it -p 7687:7687 -p 7444:7444 -p 3000:3000 memgraph/memgraph-platform:latest
curl https://install.memgraph.com | sh
```

To run it on Windows, execute the following command in the console:

```
iwr https://windows.memgraph.com | iex
```

The above command runs a script that downloads a Docker Compose file to your system, builds and starts `memgraph-mage` and `memgraph-lab` Docker services in two separate containers.

## Import NetworkX graph into Memgraph

### Prerequisites
Expand Down
1 change: 1 addition & 0 deletions gqlalchemy/transformations/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@
NUM_NODES = "num_nodes"
DEFAULT_NODE_LABEL = "NODE"
DEFAULT_EDGE_TYPE = "RELATIONSHIP"
TFGNN_ID = "tfgnn_id"
12 changes: 10 additions & 2 deletions gqlalchemy/transformations/export/graph_transporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
except ModuleNotFoundError:
PyGTranslator = None

try:
from gqlalchemy.transformations.translators.tfgnn_translator import TFGNNTranslator
except ModuleNotFoundError:
TFGNNTranslator = None


class GraphTransporter(Transporter):
"""Here is a possible example for using this module:
Expand All @@ -52,7 +57,7 @@ def __init__(
>>> transporter = GraphTransporter("dgl")
graph = transporter.export()
Args:
graph_type: dgl, pyg or nx
graph_type: dgl, pyg, nx or tfgnn
"""
super().__init__()
self.graph_type = graph_type.upper()
Expand All @@ -64,8 +69,11 @@ def __init__(
self.translator = PyGTranslator(host, port, username, password, encrypted, client_name, lazy)
elif self.graph_type == GraphType.NX.name:
self.translator = NxTranslator(host, port, username, password, encrypted, client_name, lazy)
elif self.graph_type == GraphType.TFGNN.name:
raise_if_not_imported(dependency=TFGNNTranslator, dependency_name="tensorflow-gnn")
self.translator = TFGNNTranslator(host, port, username, password, encrypted, client_name, lazy)
else:
raise ValueError("Unknown export option. Currently supported are DGL, PyG and NetworkX.")
raise ValueError("Unknown export option. Currently supported are DGL, PyG, NetworkX and TFGNN.")

def export(self):
"""Creates graph instance for the wanted export option."""
Expand Down
2 changes: 1 addition & 1 deletion gqlalchemy/transformations/graph_type.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from enum import Enum

GraphType = Enum("GraphType", ["DGL", "PYG", "NX"])
GraphType = Enum("GraphType", ["DGL", "PYG", "NX", "TFGNN"])
Loading