CtrlK
BlogDocsLog inGet started
Tessl Logo

neo4j-snowflake-graph-analytics-skill

Run Neo4j Graph Analytics algorithms (PageRank, Louvain, WCC, Dijkstra, KNN, Node2Vec, FastRP, GraphSAGE) directly inside Snowflake without moving data. Use when running graph algorithms against Snowflake tables via the Neo4j Snowflake Native App ("GDS Snowflake", "graph algorithms in Snowflake", "Neo4j Graph Analytics"). Covers installation, privilege setup, project-compute-write pattern, and SQL CALL syntax. Does NOT cover Cypher or Neo4j DBMS queries — use neo4j-cypher-skill. Does NOT cover Aura Graph Analytics — use neo4j-aura-graph-analytics-skill. Does NOT cover self-managed GDS — use neo4j-gds-skill.

88

1.36x
Quality

82%

Does it follow best practices?

Impact

100%

1.36x

Average score across 3 eval scenarios

SecuritybySnyk

Passed

No known issues

SKILL.md
Quality
Evals
Security

Snowflake Native App — graph algorithm power inside Snowflake. Data stays in Snowflake; project into a graph, run algorithms via SQL CALL, results written back to Snowflake tables.

Docs: https://neo4j.com/docs/snowflake-graph-analytics/current/


When to Use

  • Running graph algorithms / GDS in Snowflake
  • Data in Snowflake tables
  • On-demand / pipeline workloads — ephemeral sessions, pay per session-minute
  • Full isolation from the live database during analytics

When NOT to Use

  • Aura Pro with embedded GDS pluginneo4j-gds-skill
  • Aura Graph Analyticsneo4j-aura-graph-analytics-skill
  • Self-managed Neo4j with embedded GDS pluginneo4j-gds-skill
  • Writing Cypher queriesneo4j-cypher-skill

Key Concepts

Project → Compute → Write

Every algorithm run follows three steps:

  1. Project — specify node/relationship tables; app builds in-memory graph
  2. Compute — run algorithm with config parameters
  3. Write — results written back to a Snowflake table

Required Table Columns

Table typeRequired columnsOptional columns
Node tablenodeId (Number)Any additional columns become node properties
Relationship tablesourceNodeId (Number), targetNodeId (Number)Any additional columns become relationship properties

If your tables use different column names, create a view aliasing to nodeId, sourceNodeId, targetNodeId.

Graph Orientation

When projecting relationships, you can set orientation:

  • NATURAL (default) — directed, source → target
  • UNDIRECTED — treated as bidirectional
  • REVERSE — direction flipped

Installation

  1. Go to the Snowflake Marketplace
  2. Install Neo4j Graph Analytics (default app name: Neo4j_Graph_Analytics)
  3. During install, enable Event sharing when prompted
  4. After install, go to Data Products → Apps → Neo4j Graph Analytics → Privileges → Grant
  5. Grant CREATE COMPUTE POOL and CREATE WAREHOUSE privileges, then click Activate

Privilege Setup (run once per database/schema)

-- Step 1: Use ACCOUNTADMIN to set up roles and grants
USE ROLE ACCOUNTADMIN;

-- Create a consumer role for users of the application
CREATE ROLE IF NOT EXISTS MY_CONSUMER_ROLE;
GRANT APPLICATION ROLE Neo4j_Graph_Analytics.app_user TO ROLE MY_CONSUMER_ROLE;
SET MY_USER = (SELECT CURRENT_USER());
GRANT ROLE MY_CONSUMER_ROLE TO USER IDENTIFIER($MY_USER);

-- Step 2: Create a database role and grant it to the app
USE DATABASE MY_DATABASE;
CREATE DATABASE ROLE IF NOT EXISTS MY_DB_ROLE;
GRANT USAGE ON DATABASE MY_DATABASE TO DATABASE ROLE MY_DB_ROLE;
GRANT USAGE ON SCHEMA MY_DATABASE.MY_SCHEMA TO DATABASE ROLE MY_DB_ROLE;
GRANT SELECT ON ALL TABLES IN SCHEMA MY_DATABASE.MY_SCHEMA TO DATABASE ROLE MY_DB_ROLE;
GRANT SELECT ON ALL VIEWS IN SCHEMA MY_DATABASE.MY_SCHEMA TO DATABASE ROLE MY_DB_ROLE;
GRANT SELECT ON FUTURE TABLES IN SCHEMA MY_DATABASE.MY_SCHEMA TO DATABASE ROLE MY_DB_ROLE;
GRANT SELECT ON FUTURE VIEWS IN SCHEMA MY_DATABASE.MY_SCHEMA TO DATABASE ROLE MY_DB_ROLE;
GRANT CREATE TABLE ON SCHEMA MY_DATABASE.MY_SCHEMA TO DATABASE ROLE MY_DB_ROLE;
GRANT DATABASE ROLE MY_DB_ROLE TO APPLICATION Neo4j_Graph_Analytics;

-- Step 3: Grant the consumer role access to output tables
GRANT USAGE ON DATABASE MY_DATABASE TO ROLE MY_CONSUMER_ROLE;
GRANT USAGE ON SCHEMA MY_DATABASE.MY_SCHEMA TO ROLE MY_CONSUMER_ROLE;
GRANT SELECT ON FUTURE TABLES IN SCHEMA MY_DATABASE.MY_SCHEMA TO ROLE MY_CONSUMER_ROLE;

-- Step 4: Switch to the consumer role to run algorithms
USE ROLE MY_CONSUMER_ROLE;

Replace P2P, PUBLIC, GRAPH_USER_ROLE, and GRAPH_DB_ROLE with your actual names throughout.


Running an Algorithm — Full Example

-- Optional: set default database to avoid fully-qualified names
USE DATABASE Neo4j_Graph_Analytics;
USE ROLE GRAPH_USER_ROLE;

-- Call WCC (Weakly Connected Components)
CALL Neo4j_Graph_Analytics.graph.wcc('CPU_X64_XS', {
    'defaultTablePrefix': 'P2P.PUBLIC',
    'project': {
        'nodeTables': ['USER_VW'],
        'relationshipTables': {
            'AGG_TRANSACTIONS_VW': {
                'sourceTable': 'P2P.PUBLIC.USER_VW',
                'targetTable': 'P2P.PUBLIC.USER_VW',
                'orientation': 'NATURAL'
            }
        }
    },
    'compute': { 'consecutiveIds': true },
    'write': [{
        'nodeLabel': 'NODES',
        'outputTable': 'USER_COMPONENTS'
    }]
});

-- Inspect results
SELECT * FROM P2P.PUBLIC.USER_COMPONENTS;

First argument is the compute pool size:

PoolUse
CPU_X64_XSDev / small graphs
CPU_X64_S/M/LProgressively larger
HIGHMEM_X64_S/M/LLarge graphs, lower CPU need
GPU_NV_S/XS, GPU_GCP_NV_L4_1_24GCompute-intensive (GraphSAGE); GPU not available in all regions

See Estimating Jobs to choose size.

Available Algorithms

Community Detection

AlgorithmProcedureUse case
Weakly Connected Componentsgraph.wccFind disconnected subgraphs
Louvaingraph.louvainCommunity detection, modularity optimisation
Leidengraph.leidenImproved community detection (more stable than Louvain)
K-Means Clusteringgraph.kmeansCluster nodes by node properties
Triangle Countgraph.triangle_countMeasure local clustering / detect dense subgraphs

Centrality

AlgorithmProcedureUse case
PageRankgraph.pagerankRank nodes by influence
Article Rankgraph.article_rankPageRank variant, discounts high-degree neighbours
Betweenness Centralitygraph.betweennessFind bridge nodes in a network
Degree Centralitygraph.degreeCount direct connections per node

Pathfinding

AlgorithmProcedureUse case
Dijkstra Source-Targetgraph.dijkstra_source_targetShortest path between two nodes
Dijkstra Single-Sourcegraph.dijkstra_single_sourceShortest paths from one node to all others
Delta-Stepping SSSPgraph.delta_steppingFaster parallel shortest paths
Breadth First Searchgraph.bfsBFS traversal from a source node
Yen's K-Shortest Pathsgraph.yensTop-K shortest paths between two nodes
Max Flowgraph.max_flowMaximum flow through a network
FastPathgraph.fastpathFast approximate shortest paths

Similarity

AlgorithmProcedureUse case
Node Similaritygraph.node_similarityFind similar nodes based on shared neighbours
Filtered Node Similaritygraph.filtered_node_similarityNode similarity with source/target filters
K-Nearest Neighborsgraph.knnFind K most similar nodes
Filtered KNNgraph.filtered_knnKNN with source/target filters

Node Embeddings / ML

AlgorithmProcedureUse case
Fast Random Projection (FastRP)graph.fastrpFast node embeddings
Node2Vecgraph.node2vecRandom-walk-based node embeddings
HashGNNgraph.hashgnnGNN-inspired embeddings without training
GraphSAGE (train)graph.graphsage_trainTrain inductive node embeddings
GraphSAGE (predict)graph.graphsage_predictPredict with a trained GraphSAGE model
Node Classification (train)graph.node_classification_trainSupervised node label prediction
Node Classification (predict)graph.node_classification_predictApply trained node classifier

Projection Configuration Reference

{
  "project": {
    "nodeTables": [
      "DB.SCHEMA.TABLE_A",
      "DB.SCHEMA.TABLE_B"
    ],
    "relationshipTables": {
      "DB.SCHEMA.REL_TABLE": {
        "sourceTable": "DB.SCHEMA.TABLE_A",
        "targetTable": "DB.SCHEMA.TABLE_B",
        "orientation": "NATURAL"
      }
    }
  }
}
  • defaultTablePrefix — use when all tables are in the same schema
  • Multiple node/relationship tables supported — each maps to a different label/type
  • Extra columns become node/relationship properties (e.g. weight column for weighted paths)

Write Configuration Reference

{
  "write": [
    {
      "nodeLabel": "TABLE_A",
      "outputTable": "DB.SCHEMA.OUTPUT_TABLE",
      "nodeProperty": "score"
    }
  ]
}
  • nodeLabel — node table name without schema prefix
  • outputTable — created or overwritten
  • nodeProperty (optional) — which computed property to write if algorithm produces multiple

For relationship results (KNN, Node Similarity):

{
  "write": [
    {
      "relationshipType": "SIMILAR",
      "outputTable": "DB.SCHEMA.SIMILARITY_OUTPUT"
    }
  ]
}

Common Patterns

Chaining Algorithms

Results write to tables — feed one algorithm's output into the next. FUTURE TABLES grant (done in setup) lets the app read tables it just created.

-- Step 1: Run FastRP to generate embeddings
CALL Neo4j_Graph_Analytics.graph.fastrp('CPU_X64_XS', { ... });

-- Step 2: Run KNN on the embedding output
CALL Neo4j_Graph_Analytics.graph.knn('CPU_X64_XS', { ... });

Using Views Instead of Renaming Columns

Create views with required column names and supported data types. Convert categorical data to numerical scores.

CREATE VIEW MY_SCHEMA.NODES_VIEW AS
  SELECT user_id AS nodeId, name, age
  FROM MY_SCHEMA.USERS;

CREATE VIEW MY_SCHEMA.RELS_VIEW AS
  SELECT from_user AS sourceNodeId, to_user AS targetNodeId, weight
  FROM MY_SCHEMA.CONNECTIONS;

Troubleshooting

ProblemSolution
Insufficient privilegesCheck the app has SELECT on your tables and CREATE TABLE on the schema
Column nodeId not foundYour table is missing the required column — create a view that aliases it
Compute pool not availableThe pool may still be starting up; wait a minute and retry
Algorithm returns no resultsCheck your node/relationship tables are not empty and projections are correct

Full troubleshooting guide: https://neo4j.com/docs/snowflake-graph-analytics/current/troubleshooting/


Further Reading

Repository
neo4j-contrib/neo4j-skills
Last updated
Created

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.