from redisgraph import Node from redisgraph import Graph # create an empty graph graph = Graph('mygraph') # add a new node with ID=1 and properties node1 = Node(label='person', properties={'name': 'John', 'age': 30}) graph.add_node(node1)
node2 = Node(label='person', properties={'name': 'Jane', 'age': 25}) node3 = Node(label='person', properties={'name': 'Bob', 'age': 40}) graph.add_node(node2, node3)In this example, we create two additional nodes `node2` and `node3` and add them to the graph using a single call to `add_node()`. Overall, the `add_node()` function in Python RedisGraph is used to add new nodes to a graph, and it is part of the RedisGraph package library.