摘要:
#!/usr/bin/env python3.3# -*- coding:utf-8 -*-# Copyright 2013'''单源最短路径:1)bellman_ford算法:将所有的边进行|V|-1次循环,每次循环对所有边进行松弛操作2)dijkstra算法:将V-S中顶点按最短路径递增的次序加入到S中,并对邻接边进行松弛操作'''def bellman_ford(graph, graph_size, s): low_weight = [w for w in graph[0]] low_weight[s] = 0 for repeat in 阅读全文