> ## Documentation Index
> Fetch the complete documentation index at: https://docs.turingdb.ai/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

<Tabs>
  <Tab title="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.
    </Warning>
  </Tab>

  <Tab title="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.
    </Warning>
  </Tab>
</Tabs>
