Skip to content

Commit a26d63a

Browse files
Spanning Tree agora mostra custo total da arvore
1 parent b19123f commit a26d63a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

trabalho3.py

+7
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,14 @@ def spanning_tree(): # SPANNING TREE -------------------------------------------
401401
t.es["weight"] = aux2
402402
t.vs["label"] = t.vs["name"]
403403
t.es["label"] = t.es["weight"]
404+
405+
# calculando o custo total da arvore gerada
406+
custo_total = 0
407+
for tzin in t.es["weight"]:
408+
custo_total = custo_total + tzin
409+
404410
print 'A seguir a sua arvore gerada a partir do Spanning Tree algorithm!'
411+
print 'Que tem custo total = ' + str(custo_total)
405412
plot(t, layout = "kk")
406413
salvar(t, "spanning_tree.png", "kk")
407414

0 commit comments

Comments
 (0)