-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimpleDemo.py
More file actions
17 lines (15 loc) · 791 Bytes
/
simpleDemo.py
File metadata and controls
17 lines (15 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from Graph import Graph
# --- DIM 4 ---
g = Graph(4)
print(f'4D Hypercube Adjacency List:\n{g}\n')
print(f'Path from 0000 to 1111 in 4D Hypercube:\n{g.path("0000", "1111")}\n')
g.subgraph(12)
print(f'4D Hypercube subgraph Adjacency List:\n{g}\n')
print(f'Path from 0000 to 1111 in 4D Hypercube subgraph:\n{g.path("0000", "1111")}\n')
print(f'Shortest path from 0000 to 1111 in 4D Hypercube subgraph:\n{g.shortest_path("0000", "1111")}\n')
# --- DIM 15 ---
g = Graph(15, seed=5)
print(f'Path from {"0"*15} to {"1"*15} in 15D Hypercube:\n{g.path("0"*15, "1"*15)}\n')
g.subgraph(2e5)
print(f'Path from {"0"*15} to {"1"*15} in 15D Hypercube subgraph:\n{g.path("0"*15, "1"*15)}\n')
print(f'Shortest path from {"0"*15} to {"1"*15} in 15D Hypercube subgraph:\n{g.shortest_path("0"*15, "1"*15)}')