文件名称:Floyd-CSharp
介绍说明--下载内容均来自于网络,请自行研究使用
弗洛伊德(Floyd)算法 主要是用于计算图中所有顶点对之间的最短距离长度的算法,如果是要求某一个特定点到图中所有顶点之间的最短距离可以用Dijkstra(迪杰斯特拉)算法来求。
弗洛伊德(Floyd)算法的算法过程是:
1、从任意一条单边路径开始。所有两点之间的距离是边的权,如果两点之间没有边相连,则权为无穷大。
2、对于每一对顶点 u 和 v,看看是否存在一个顶点 w 使得从 u 到 w 再到 v 比已知的路径更短。如果是更新它。
把图用邻接矩阵G表示出来,如果从Vi到Vj有路可达,则G[i,j]=d,d表示该路的长度;否则G[i,j]=无穷大。定义一个矩阵D用来记录所插入点的信息,D[i,j]表示从Vi到Vj需要经过的点,初始化D[i,j]=j。把各个顶点插入图中,比较插点后的距离与原来的距离,G[i,j] = min( G[i,j], G[i,k]+G[k,j] ),如果G[i,j]的值变小,则D[i,j]=k。在G中包含有两点之间最短道路的信息,而在D中则包含了最短路径的信息。
比如,要寻找从V5到V1的路径。根据D,假如D(5,1)=3则说明从V5到V1经过V3,路径为{V5,V3,V1},如果D(5,3)=3,说明V5与V3直接相连,如果D(3,1)=1,说明V3与V1直接相连。 -Floyd (Floyd) algorithm is mainly used to calculate the length of the shortest distance between the drawing algorithm between all pairs of vertices, if the requirements of a specific point to the diagram all the shortest distance between vertices can Dijkstra (Dinger Stella) algorithm to find.
Floyd algorithm process (Floyd) algorithm is:
1, starting any one-sided way. The distance between two points is all right edge, if there is no edge connected between two points, the right to infinity.
2. For every pair of vertices u and v, and see if there is a vertex w such that w u to v and then shorter than the known path. If you are updating it.
Figure that out of the adjacency matrix G, if there is a road up Vi to Vj, then G [i, j] = d, d represents the length of the path otherwise G [i, j] = infinity. Define a matrix D used to record the information of the inserted point, D [i, j] represents Vi to Vj need to go through the points, initialize D [i, j] = j. The inset in e
弗洛伊德(Floyd)算法的算法过程是:
1、从任意一条单边路径开始。所有两点之间的距离是边的权,如果两点之间没有边相连,则权为无穷大。
2、对于每一对顶点 u 和 v,看看是否存在一个顶点 w 使得从 u 到 w 再到 v 比已知的路径更短。如果是更新它。
把图用邻接矩阵G表示出来,如果从Vi到Vj有路可达,则G[i,j]=d,d表示该路的长度;否则G[i,j]=无穷大。定义一个矩阵D用来记录所插入点的信息,D[i,j]表示从Vi到Vj需要经过的点,初始化D[i,j]=j。把各个顶点插入图中,比较插点后的距离与原来的距离,G[i,j] = min( G[i,j], G[i,k]+G[k,j] ),如果G[i,j]的值变小,则D[i,j]=k。在G中包含有两点之间最短道路的信息,而在D中则包含了最短路径的信息。
比如,要寻找从V5到V1的路径。根据D,假如D(5,1)=3则说明从V5到V1经过V3,路径为{V5,V3,V1},如果D(5,3)=3,说明V5与V3直接相连,如果D(3,1)=1,说明V3与V1直接相连。 -Floyd (Floyd) algorithm is mainly used to calculate the length of the shortest distance between the drawing algorithm between all pairs of vertices, if the requirements of a specific point to the diagram all the shortest distance between vertices can Dijkstra (Dinger Stella) algorithm to find.
Floyd algorithm process (Floyd) algorithm is:
1, starting any one-sided way. The distance between two points is all right edge, if there is no edge connected between two points, the right to infinity.
2. For every pair of vertices u and v, and see if there is a vertex w such that w u to v and then shorter than the known path. If you are updating it.
Figure that out of the adjacency matrix G, if there is a road up Vi to Vj, then G [i, j] = d, d represents the length of the path otherwise G [i, j] = infinity. Define a matrix D used to record the information of the inserted point, D [i, j] represents Vi to Vj need to go through the points, initialize D [i, j] = j. The inset in e
(系统自动生成,下载前可以参看下载内容)
下载文件列表
Floyd-C#.txt