-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
47 lines (34 loc) · 1.76 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
# Felipe Nacimento Rocha 17/0050084
# Teoria e Aplicacao de Grafos Trabalho 1
# Para melhor visualizacao da interface recomenda-se o uso de python3, entretanto eh possivel ler os resultados em python2
from bron_no_pivot import bron_kerb_algorithm_no_pivot
from bron_pivot import bron_kerb_algorithm_with_pivot
from bron import read_file, create_dolphin_list, get_all_vertex
from clustering import average_cluster
import os
def main():
interface()
def interface():
golfinhos_txt = read_file('soc-dolphins.txt')
lista_adjacencia_golfinhos = create_dolphin_list(golfinhos_txt)
os.system('cls' if os.name == 'nt' else 'clear')
menu_selection = 0
while(int(menu_selection) != 5):
print("Trabalho teoria de Grafos 1 - Algoritmos Bron-Kerbosch")
menu_selection = input("1) Lista de Adjacencias\n"
"2) Algoritmo Bron-Kerbosch sem Pivo \n"
"3) Algoritmo Bron-Kerbosch com Pivo\n"
"4) O Coeficiente médio de Aglomeração do Grafo."
"\n5)Sair \nSelecao: ")
print(menu_selection)
if int(menu_selection) == 1:
print("Lista de adjacencia: \n", lista_adjacencia_golfinhos)
elif int(menu_selection) == 2:
bron_kerb_algorithm_no_pivot(
R=[], P=get_all_vertex(lista_adjacencia_golfinhos), X=[])
elif int(menu_selection) == 3:
bron_kerb_algorithm_with_pivot(
R=[], P=get_all_vertex(lista_adjacencia_golfinhos), X=[])
elif int(menu_selection) == 4:
print("Coeficiente médio de Aglomeração do Grafo: ", average_cluster(lista=lista_adjacencia_golfinhos))
main()