Deadline : 2020/12/XX 23:30 "Read before submission"
包含求解下列三個問題:
1. 單一起點到所有目的地之最短路徑
2. 任意兩點間的最短路徑
3. 計算出遞移封閉
This assignment needs to solve three problems:
1. single source all destinations (SSAD)
2. all pairs shortest paths (All-pairs)
3. transitive closure
輸入:directed graph G=(V, E) and the weights on the edges E (as well as a starting vertex u for problem 1)
輸出: 最短距離 shortest paths, all pairs shortest paths, and transitive closure of G
1.Generate a graph G=(V, E) in random, the weights and density of the edges in G can be assigned by user.
2. Find shortest distance from single source to every vertices (single source all destinations)
3. Find shortest distance between and two points
4.User can trace the process of solving this problem.
2.Find transitive closure of the given graph.
For Problem 1: Report the shortest paths from the source to all destinations (SSAD)
For Problem 2: Report the shortest paths for all pairs
Generate 2D weight matrix using random numbers (Below shows an undirected graph)
Compute solutions (shortest distances) to the problem of "single source all destinations" where column "from" is the connection table in which from[j] stores the vertex who connects to j with the shortest edge 0<=j<=n-1
Report the shortest paths from the source to all destinations
Compute solutions (shortest distances) to the problem of "all pairs"
Compute the connection table for all vertices
Report the shortest paths for each pair of two vertices (I)
Report the shortest paths for each pair of two vertices (II)
The transitive closure of G
Generate 2D weight matrix using random numbers (Below shows another undirected graph)
Compute solutions (shortest distances) to the problem of "single source all destinations" where column "from" is the connection table in which from[j] stores the vertex who connects to j with the shortest edge 0<=j<=n-1
Report the shortest paths from the source to all destinations
Compute solutions (shortest distances) to the problem of "all pairs"
Compute the connection table for all vertices
Report the shortest paths for each pair of two vertices (Something is wrong here. Please find it out and figure out what is going on.)
Compute transitive closure using the weight matrix as the 0/1 adjacency matrix
Reduce the density of the edges in G' (which is directed) by proper parameters
The All pairs shortest paths of G' (The connectivity of vertices is sparse.)
The transitive closure of G'
Dijkstra algorithm
Use 'from' array to trace shortest path
Result of all pair shortest path
Result of transitive closure