File tree 2 files changed +15
-1
lines changed 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ result = redis_graph.query(query)
56
56
for record in result.result_set:
57
57
path = record[0 ]
58
58
# See path.py for more path API.
59
- print (path.edge_count(), path.nodes_count() )
59
+ print (path)
60
60
61
61
62
62
# All done, remove graph.
Original file line number Diff line number Diff line change @@ -51,3 +51,17 @@ def add_edge(self, edge):
51
51
52
52
def __eq__ (self , other ):
53
53
return self .nodes == other .nodes and self .edges == other .edges
54
+
55
+ def __str__ (self ):
56
+ res = "<"
57
+ edge_count = self .edge_count ()
58
+ for i in range (0 , edge_count ):
59
+ node_id = self .get_node (i ).id
60
+ res += "(" + str (node_id ) + ")"
61
+ edge = self .get_relationship (i )
62
+ res += "-[" + str (int (edge .id )) + "]->" if edge .src_node == node_id else "<-[" + str (int (edge .id )) + "]-"
63
+ node_id = self .get_node (edge_count ).id
64
+ res += "(" + str (node_id ) + ")"
65
+ res += ">"
66
+ return res
67
+
You can’t perform that action at this time.
0 commit comments