forked from kevinrvaz/Graph-DS-Library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
46 lines (41 loc) · 1.12 KB
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# from representations.adjacent_set import AdjacentSet
# from representations.adjacent_matrix import AdjacentMatrix
from matrix import matrix
# import sys
# graph=AdjacentMatrix(300,matrix,directed=False)
# print(f"path between 0 and 292")
# for node in graph.shortest_path_weighted(0,268):
# print(node)
# graph=AdjacentMatrix(5,directed=False)
# # sys.setrecursionlimit(10000)
# graph.add_edge(0,1)
# graph.add_edge(0,2)
# graph.add_edge(1,3)
# graph.add_edge(1,4)
# for node in graph.shortest_path_unweighted(0,4):
# print(node)
'''
graph=AdjacentSet(5,True)
graph.add_edge(0,1,2)
graph.add_edge(0,2,4)
graph.add_edge(2,3,2)
graph.add_edge(3,1,1)
graph.add_edge(3,4,1)
graph.add_edge(1,4,1)
graph.display()
for node in graph.shortest_path_weighted(2,4):
print(node,end=" ")
print()
for node in graph.breadth_first_search():
print(node,end=" ")
print()
for node in graph.depth_first_search():
print(node,end=" ")
print()
for node in graph.topological_sort():
print(node,end=" ")
print()
'''
from algorithms.graph_algorithms import Graph
graph=Graph(300,matrix=matrix,directed=False)
graph.display()