This repository has been archived by the owner on Jul 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
52 lines (42 loc) · 1.51 KB
/
main.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
47
48
49
50
51
52
"""
Thibault LEPEZ, Matthieu GEDEON, Daniil ROSSO
L3 int - G2
"""
from Graph import Graph
from graphUtils import printMatrix, printArray
start = True
while(start):
graphNumber = input("Enter the graph number: ")
filepath = "./graphs/Int2-5-graph{}.txt".format(graphNumber)
try:
print("# Reading graph from " + filepath)
graph = Graph.fromFile(filepath)
except FileNotFoundError:
print("[ERROR] File not found")
else:
print(graph)
print("# Adjency matrix")
printMatrix(graph.getAdjencyMatrix())
print("# Values matrix")
printMatrix(graph.getValueMatrix())
print("# Detecting cicles")
if (graph.hasCicle()):
print('The graph has a cicle\n')
else:
print("The graph has no cicle\n")
print("# Finding the ranks")
ranks = graph.getRanks()
print("The ranks are ", end="")
printArray(ranks)
print("For following vertices ", end="")
printArray(graph.getVerticeList())
print("\n# Checking if graph is a scheduling graph")
if (graph.isScheduling(ranks)):
print("The graph is a scheduling graph\n")
print('# Computing calendar')
graph.getCalendars(ranks)
else:
print("The graph is not a scheduling graph")
finally:
choice = input("\nStart again with another graph? [y/n]: ")
start = (choice == 'y' or choice == 'Y')