def final_node_query(self, node_index): col = db.get_column(node_index) paths = [] for path_index, t in col.items(): if t[0] == (t[1] - 1): paths.append(db.get_path(path_index)) return paths
def node_query(self, node_index): col = db.get_column(node_index) paths = [] for path_index in col.keys(): paths.append(db.get_path(path_index)) return paths
def test_stored_paths_maintains_order(): paths = [['nod1', 'edge1', 'nod2'], ['nod2', 'edge2', 'nod3']] db.replace_all_paths(paths) assert ['nod1', 'edge1', 'nod2'] == db.get_path(0) assert ['nod2', 'edge2', 'nod3'] == db.get_path(1)
def test_stored_path_returns_as_list(): paths = [['nod1', 'edge1', 'nod2'], ['nod2', 'edge2', 'nod3']] db.replace_all_paths(paths) assert isinstance(db.get_path(1), list)