> ## Documentation Index
> Fetch the complete documentation index at: https://turingdb.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Nodes and Edges

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

> [tab] Cypher
>
> ```jsx theme={null}
> // 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).
>
> ```jsx theme={null}
> // 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
> ```
>
> > [!WARNING]
> >
> > In the case you create the nodes then the edges, you need to commit your changes after node creation.

> [tab] Python SDK
>
> ```python theme={null}
> # 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).
>
> ```python theme={null}
> # 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")
> ```
>
> > [!WARNING]
> >
> > In the case you create the nodes then the edges, you need to commit your changes after node creation.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.