Neo4j | Sheetly Cheat Sheet

Last Updated: November 21, 2025

Neo4j

Graph database management system

Core Concepts

Item Description
Node Entity with properties
Relationship Connection between nodes
Property Key-value data on nodes/relationships
Label Node type/category
Cypher Query language for graphs
Path Sequence of connected nodes

Cypher Examples

// Create nodes
CREATE (p:Person {name: 'Alice', age: 30})
CREATE (c:Company {name: 'TechCorp'})

// Create relationship
CREATE (p)-[:WORKS_AT {since: 2020}]->(c)

// Query patterns
MATCH (p:Person)-[:WORKS_AT]->(c:Company)
WHERE p.age > 25
RETURN p.name, c.name

// Find shortest path
MATCH path = shortestPath(
  (p1:Person {name: 'Alice'})-[*]-(p2:Person {name: 'Bob'})
)
RETURN path

Common Patterns

Item Description
(n) Match any node
(n:Label) Match node with label
-[r]-> Match directed relationship
-[r:TYPE]-> Match relationship by type
[*1..3] Variable length path (1-3 hops)

Best Practices

  • Use indexes on frequently queried properties
  • Design relationships to match query patterns
  • Use EXPLAIN and PROFILE for query optimization
  • Limit result sets with LIMIT clause

💡 Pro Tips

Quick Reference

Use graph algorithms for complex path analysis

← Back to Databases & APIs | Browse all categories | View all cheat sheets