$npx -y skills add neo4j-contrib/neo4j-skills --skill neo4j-gds-skillNeo4j Graph Data Science (GDS) embedded plugin via Python client or Cypher —
| 1 | ## When to Use |
| 2 | - Running GDS algorithms against embedded GDS plugin through Python client (`graphdatascience`) |
| 3 | - Running GDS algorithms through `CALL gds.*` Cypher procedures |
| 4 | - Aura Pro, self-managed Neo4j, local Neo4j, or offline DBMS with GDS plugin installed |
| 5 | - Projecting named in-memory graphs, running centrality/community/similarity/path/embedding algorithms |
| 6 | - Chaining algorithms via `mutate` mode; building FastRP → KNN pipelines |
| 7 | - Writing node embeddings for Neo4j vector indexes / structural similarity search |
| 8 | - Memory estimation before large graph operations |
| 9 | |
| 10 | ## When NOT to Use |
| 11 | - **Aura Graph Analytics Sessions / AGA / `GdsSessions` / `AuraGraphDataScience`** → `neo4j-aura-graph-analytics-skill` |
| 12 | - **AuraDB Cypher API with `{ memory: ... }` or `{ sessionId: ... }`** → `neo4j-aura-graph-analytics-skill` |
| 13 | - **Cypher query authoring** → `neo4j-cypher-skill` |
| 14 | - **Driver/connection setup** → `neo4j-driver-python-skill` |
| 15 | - **GraphRAG retrieval** → `neo4j-graphrag-skill` |
| 16 | - **Creating/querying vector indexes over written embeddings** → `neo4j-vector-index-skill` |
| 17 | |
| 18 | | Context | Use | |
| 19 | |---|---| |
| 20 | | Aura Pro with GDS plugin | This skill | |
| 21 | | Self-managed/local/offline Neo4j with GDS plugin | This skill | |
| 22 | | AuraDB serverless analytics session | `neo4j-aura-graph-analytics-skill` | |
| 23 | | Self-managed Neo4j attached to AGA session | `neo4j-aura-graph-analytics-skill` | |
| 24 | | Non-Neo4j data source | `neo4j-aura-graph-analytics-skill` | |
| 25 | |
| 26 | --- |
| 27 | |
| 28 | ## Pre-flight |
| 29 | |
| 30 | Use only with embedded GDS plugin. |
| 31 | |
| 32 | ```python |
| 33 | from graphdatascience import GraphDataScience |
| 34 | |
| 35 | gds = GraphDataScience("neo4j+s://xxx.databases.neo4j.io", auth=("neo4j", "pw"), aura_ds=True) |
| 36 | gds = GraphDataScience("bolt://localhost:7687", auth=("neo4j", "password")) |
| 37 | print(gds.server_version()) |
| 38 | ``` |
| 39 | |
| 40 | ```cypher |
| 41 | RETURN gds.version() AS gds_version |
| 42 | ``` |
| 43 | |
| 44 | If `Unknown function 'gds.version'` → GDS plugin unavailable. AuraDB serverless analytics → `neo4j-aura-graph-analytics-skill`. Self-managed/local → install or enable GDS plugin. |
| 45 | |
| 46 | ```bash |
| 47 | pip install graphdatascience # Python client |
| 48 | pip install graphdatascience[rust_ext] # 3–10× faster serialization |
| 49 | ``` |
| 50 | |
| 51 | Compatibility: graphdatascience v1.22 — GDS >= 2.6 and < 2.28 / < 2026.6, Python >= 3.10 and < 3.15, Neo4j Driver >= 4.4.12 and < 7.0. |
| 52 | |
| 53 | V2 rules: |
| 54 | - Prefer `gds.v2.*` when endpoint exists. |
| 55 | - Use snake_case endpoints and parameters: `page_rank`, `fast_rp`, `mutate_property`, `write_property`. |
| 56 | - Use typed result attributes: `result.write_millis`, not `result["writeMillis"]`. |
| 57 | - Use v1 if v2 endpoint missing/incompatible; label fallback. |
| 58 | |
| 59 | --- |
| 60 | |
| 61 | ## Graph Catalog Operations |
| 62 | |
| 63 | ### Native Projection |
| 64 | |
| 65 | ```cypher |
| 66 | CALL gds.graph.project( |
| 67 | 'myGraph', |
| 68 | ['Person', 'City'], |
| 69 | { KNOWS: { orientation: 'UNDIRECTED' }, LIVES_IN: {} } |
| 70 | ) |
| 71 | YIELD graphName, nodeCount, relationshipCount |
| 72 | ``` |
| 73 | |
| 74 | ```python |
| 75 | G, result = gds.v2.graph.project("myGraph", "Person", "KNOWS") |
| 76 | print(result.node_count, result.relationship_count) |
| 77 | |
| 78 | G, result = gds.v2.graph.project( |
| 79 | "myGraph", |
| 80 | {"Person": {"properties": ["age", "score"]}, "City": {}}, |
| 81 | {"KNOWS": {"orientation": "UNDIRECTED"}, "LIVES_IN": {"properties": ["since"]}} |
| 82 | ) |
| 83 | ``` |
| 84 | |
| 85 | Native projection: plugin/simple Python-client workflow only. AGA Sessions → `neo4j-aura-graph-analytics-skill`. |
| 86 | V1 fallback: `gds.graph.project(...)`. |
| 87 | |
| 88 | ### Cypher Projection (use for new Cypher workflows, filters, transforms) |
| 89 | |
| 90 | ```python |
| 91 | G, result = gds.graph.cypher.project( |
| 92 | """ |
| 93 | MATCH (source:Person)-[r:KNOWS]->(target:Person) |
| 94 | WHERE source.active = true |
| 95 | RETURN gds.graph.project($graph_name, source, target, |
| 96 | { sourceNodeProperties: source { .score }, relationshipType: 'KNOWS' }) |
| 97 | """, |
| 98 | database="neo4j", graph_name="activeGraph" |
| 99 | ) |
| 100 | ``` |
| 101 | |
| 102 | `gds.graph.cypher.project` must end with one `RETURN gds.graph.project(...)` clause. If validation fails: use `gds.run_cypher(...)`, then `gds.graph.get("graphName")`. |
| 103 | Use v1 `gds.graph.cypher.project(...)` if v2 graph projection cannot express required filter/transform. |
| 104 | |
| 105 | AGA Sessions → `neo4j-aura-graph-analytics-skill`; never use plugin Cypher projection. |
| 106 | |
| 107 | ### Undirected Projection |
| 108 | |
| 109 | Native projection: set `orientation: 'UN |