FloydWarshall

public class FloydWarshall

Floyd-Warshall algorithm to calculate the predecessor matrix and the delay between all pairs of nodes. The delay represents the distance between the two vertices and it works as the weight for the Floyd-Warshall algorithm.

Author:Rahul Simha, Weishuai Yang

Constructors

FloydWarshall

public FloydWarshall(int numVertices)

Creates a matrix of network nodes.

Parameters:
  • numVertices – number of network nodes

Methods

computeShortestPaths

public double[][] computeShortestPaths(double[][] originalDelayMatrix)

Computes the shortest path between a vertex to all the other ones, for all existing vertices. This is represented by the delay between all pairs vertices.

Parameters:
  • originalDelayMatrix – original delay matrix
Returns:

the new delay matrix (dk)

getNumVertices

public int getNumVertices()

getPk

public int[][] getPk()

Gets a copy of the predecessor matrix.

Returns:the predecessor matrix copy