from redisgraph import Graph, Node, Edge # Create a graph graph = Graph("example") # Add some nodes and edges node1 = Node(label="Person", properties={"name": "Alice"}) node2 = Node(label="Person", properties={"name": "Bob"}) edge = Edge(node1, "knows", node2) graph.add_node(node1) graph.add_node(node2) graph.add_edge(edge) # Flush the graph graph.flush() # Print the number of nodes and edges print(len(graph.nodes)) print(len(graph.edges))
0 0The graph is now empty. In conclusion, the Python RedisGraph package library provides a powerful interface for creating and managing graph databases using RedisGraph. The flush method is just one of many methods available for manipulating and querying graph data.