-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.py
42 lines (27 loc) · 832 Bytes
/
start.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
# -*- coding: utf-8 -*-
import sys
from game import game
if __name__ == "__main__":
G=game()
G.importfile('mat1.txt')
print("Strongly connected components :")
strongcomp = G.levels()
print(strongcomp)
print("Reduced matrix :")
reduced = G.reducedgraph()
for line in reduced.generatematrix():
print(line)
print("Longest path :")
'''startnode = int(input("Enter the starting node : "))
endnode = int(input("Enter the ending node : "))'''
startnode = 1
endnode = 8
i=1
for comp in strongcomp:
if comp.count(startnode) > 0:
startnode = i
if comp.count(endnode) > 0:
endnode = i
i+=1
longpath = reduced.longestpath(startnode,endnode)
print(longpath)