A set of code snippets to help you get started with Neo4j at the Graphathon. This repository provides practical examples of how to:
- Connect to and work with Neo4j databases
- Load data from external sources like BigQuery
- Create graph structures with nodes and relationships
- Visualize graph data using modern tools
notebooks/
- Jupyter notebooks with interactive examplespyproject.toml
- Project dependencies and configuration
These examples are designed to be generic starting points that you can adapt for your Graphathon projects. The specific implementation details are less important than understanding the patterns and techniques demonstrated.
- Python 3.13+
- Neo4j database (local, cloud, or Docker)
- Google Cloud access (for BigQuery examples)
- Docker and Docker Compose (for local Neo4j setup)
The easiest way to get started is using Docker Compose to run Neo4j Enterprise with APOC and Graph Data Science plugins:
# Start Neo4j Enterprise with all plugins
docker-compose up -d
# Access Neo4j Browser at http://localhost:7474
# Default credentials: neo4j/neoneoneo
The Docker setup includes:
- Neo4j Enterprise Edition
- APOC plugin for extended procedures
- Graph Data Science (GDS) plugin
- Persistent data volumes
Create a .env
file in the root directory with the following variables:
# Neo4j Database Connection
NEO4J_URI=bolt://localhost:7687
NEO4J_USER=neo4j
NEO4J_PASSWORD=password123
# For Neo4j AuraDB (cloud), use the connection string provided
# NEO4J_URI=neo4j+s://xxxxxx.databases.neo4j.io
# NEO4J_USER=neo4j
# NEO4J_PASSWORD=your_aura_password
# Google Cloud BigQuery (optional - for BigQuery examples)
GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service-account-key.json
# Or use: gcloud auth application-default login
# BigQuery Project Settings (optional)
GOOGLE_CLOUD_PROJECT=your-project-id
# Install dependencies using uv (recommended)
uv sync
# Or using pip
pip install google-cloud-bigquery>=3.36.0 ipykernel>=6.30.1 neo4j>=5.28.2 pandas>=2.3.2 yfiles-jupyter-graphs-for-neo4j>=1.7.0
Start Jupyter Lab and explore the example notebooks:
# Start Jupyter Lab
jupyter lab
# Open notebooks in the notebooks/ folder
This project includes several powerful tools for working with Neo4j:
- neo4j: Official Neo4j Python driver for database connections
- google-cloud-bigquery: For accessing BigQuery datasets
- pandas: Data manipulation and analysis
- yfiles-jupyter-graphs-for-neo4j: Advanced graph visualization in Jupyter
- ipykernel: Jupyter kernel support
- Start Neo4j with Docker:
docker-compose up -d
- Install Python dependencies:
uv sync
- Start Jupyter Lab:
jupyter lab
- Open and run the example notebooks
- Adapt the patterns for your Graphathon project
- Set up your
.env
file with the required credentials - Install dependencies with
uv sync
- Start your Neo4j instance
- Start Jupyter Lab with
jupyter lab
- Open and run the example notebooks
- Adapt the patterns for your Graphathon project
- Neo4j Connection Error: Verify your Neo4j instance is running and credentials in
.env
are correct- For Docker: Check with
docker-compose ps
anddocker-compose logs neo4j
- For Docker: Check with
- BigQuery Authentication Error: Check your Google Cloud credentials and project settings
- Missing Dependencies: Run
uv sync
to ensure all packages are installed - Docker Issues: Ensure Docker is running and you have enough memory allocated (at least 4GB recommended)
- Plugin Issues: APOC and GDS plugins are automatically installed in the Docker setup
These code snippets provide foundational patterns for:
- Connecting to Neo4j databases
- Loading data from various sources
- Creating graph structures
- Visualizing results
Use these examples as starting points and modify them for your specific Graphathon use case. The goal is to help you get up and running quickly with Neo4j!