| 14 | self.populate_graph() |
| 15 | |
| 16 | def populate_graph(self): |
| 17 | global nodes |
| 18 | global edges |
| 19 | # Construct a graph with the form: |
| 20 | # (a)-[:E1]->(b:B)-[:E1]->(c), (b)-[:E2]->(d)-[:E1]->(e) |
| 21 | a = Node(label="A", properties={"v": 'a'}) |
| 22 | b = Node(label="A", properties={"v": 'b'}) |
| 23 | c = Node(label="A", properties={"v": 'c'}) |
| 24 | d = Node(label="A", properties={"v": 'd'}) |
| 25 | e = Node(label="A", properties={"v": 'e'}) |
| 26 | |
| 27 | nodes['a'] = a |
| 28 | nodes['b'] = b |
| 29 | nodes['c'] = c |
| 30 | nodes['d'] = d |
| 31 | nodes['e'] = e |
| 32 | |
| 33 | graph.add_node(a) |
| 34 | graph.add_node(b) |
| 35 | graph.add_node(c) |
| 36 | graph.add_node(d) |
| 37 | graph.add_node(e) |
| 38 | |
| 39 | # Edges have the same property as their destination |
| 40 | ab = Edge(a, "E1", b, properties={"v": 'b'}) |
| 41 | bc = Edge(b, "E1", c, properties={"v": 'c'}) |
| 42 | bd = Edge(b, "E2", d, properties={"v": 'd'}) |
| 43 | de = Edge(d, "E1", e, properties={"v": 'e'}) |
| 44 | |
| 45 | edges[0] = ab |
| 46 | edges[1] = bc |
| 47 | edges[2] = bd |
| 48 | edges[3] = de |
| 49 | |
| 50 | graph.add_edge(ab) |
| 51 | graph.add_edge(bc) |
| 52 | graph.add_edge(bd) |
| 53 | graph.add_edge(de) |
| 54 | |
| 55 | graph.flush() |
| 56 | |
| 57 | # Verify that the contents of two arrays are equal without respect to order. |
| 58 | def compare_unsorted_arrays(self, a, b): |