TuringDB home pagelight logodark logo
  • Discord
  • GitHub
  • Website
TuringDB

Get Started

  • Introduction
  • Get Started
  • Claude Code Skill
  • Commands

Concepts

  • Overview
  • A Columnar Graph Database
  • Versioning System
  • The DataPart System
  • Zero-Locking Architecture
  • Snapshots Isolation

Benchmarks

  • Results Summary
  • Technical Report

Query Language

  • Query Language
  • CheatSheet

Importing data

  • JSONL
  • CSV
  • Neo4j
  • GML
  • Parquet

Graph Development

  • Create Graph
  • Load Graph
  • Load External data
  • Create a Change
  • List Changes
  • Create Nodes and Edges
  • Update Properties
  • Submit a Change
  • Time Travel
  • Graph Examples

Vector Search

  • Vector Search

Graph Algorithms

  • Shortest Path

Tutorials

  • Example Notebooks

Python SDK

  • Get Started
  • Reference

Troubleshooting

  • Troubleshooting
Graph Development

Create Nodes and Edges

Once you have a valid change, you can start adding new nodes and edges to it

  • Cypher
  • Python SDK
// Create a node Person (Jane) - Edge (knows) - node Person (John)
CREATE (:Person {name: 'Jane'})-[:KNOWS]->(:Person {name: 'John'})

// Commit the changes
COMMIT

In the CREATE query above, the two nodes having label Person and the edge were created in the same query. You can also create nodes and queries one by one (less efficient).

// Create two nodes Person : Jane and John
CREATE (:Person {name: 'John'})
CREATE (:Person {name: 'Jane'})

// You need to commit the changes after node creation
COMMIT

// Match Jane and John nodes to create edge of label KNOWS between them
MATCH (n:Person {name: 'Jane'}), (m:Person {name: 'John'})
CREATE (n)-[e:KNOWS]->(m)

// Commit the changes
COMMIT

In the case you create the nodes then the edges, you need to commit your changes after node creation.

# Create a node Person (Jane) - Edge (knows) - node Person (John)
client.query("CREATE (:Person {name: 'Jane'})-[:KNOWS]->(:Person {name: 'John'})")

# Commit the changes
client.query("COMMIT")

In the CREATE query above, the two nodes having label Person and the edge were created in the same query. You can also create nodes and queries one by one (less efficient).

# Create two nodes Person : Jane and John
client.query("CREATE (:Person {name: 'John'})")
client.query("CREATE (:Person {name: 'Jane'})")

# You need to commit the changes after node creation
client.query("COMMIT")

# Create edge of label KNOWS between Jane and John
client.query("""
MATCH (n:Person {name: 'Jane'}), (m:Person {name: 'John'})
CREATE (n)-[e:KNOWS]->(m)
""")

# Commit the change
client.query("COMMIT")

In the case you create the nodes then the edges, you need to commit your changes after node creation.

List ChangesUpdate Properties
githublinkedinyoutubediscord