def BellmanFord(self, src): # Distances infinies dist = [float("Inf")] * self.V dist[src] = 0 # Relache les sommets - 1 for i in range(self.V - 1): # Met a jour noeud et parents for u, v, w in self.graph: if dist[u] != float("Inf") and dist[u] + w < dist[v]: dist[v] = dist[u] + w # Verifie si cycle for u, v, w in self.graph: if dist[u] != float("Inf") and dist[u] + w < dist[v]: print "Le graphe contient des cycles négatifs" return