File tree 1 file changed +0
-33
lines changed
src/main/java/com/thealgorithms/datastructures/graphs
1 file changed +0
-33
lines changed Original file line number Diff line number Diff line change @@ -83,39 +83,6 @@ private void printDistanceMatrix() {
83
83
}
84
84
}
85
85
86
- /**
87
- * The main method that interacts with the user to input graph details
88
- * (number of vertices and adjacency matrix) and computes the shortest paths
89
- * using the Floyd-Warshall algorithm.
90
- *
91
- * @param arg Command-line arguments (not used).
92
- */
93
- public static void main (String ... arg ) {
94
- Scanner scan = new Scanner (System .in );
95
- System .out .println ("Enter the number of vertices" );
96
- int numberOfVertices = scan .nextInt ();
97
-
98
- int [][] adjacencyMatrix = new int [numberOfVertices + 1 ][numberOfVertices + 1 ];
99
-
100
- System .out .println ("Enter the Weighted Matrix for the graph" );
101
- for (int source = 1 ; source <= numberOfVertices ; source ++) {
102
- for (int destination = 1 ; destination <= numberOfVertices ; destination ++) {
103
- adjacencyMatrix [source ][destination ] = scan .nextInt ();
104
- if (source == destination ) {
105
- adjacencyMatrix [source ][destination ] = 0 ; // Distance to itself is zero.
106
- } else if (adjacencyMatrix [source ][destination ] == 0 ) {
107
- adjacencyMatrix [source ][destination ] = INFINITY ; // No direct path between source and destination.
108
- }
109
- }
110
- }
111
-
112
- System .out .println ("The Transitive Closure of the Graph:" );
113
- FloydWarshall floydWarshall = new FloydWarshall (numberOfVertices );
114
- floydWarshall .floydwarshall (adjacencyMatrix );
115
-
116
- scan .close ();
117
- }
118
-
119
86
public Object [] getDistanceMatrix () {
120
87
return distanceMatrix ;
121
88
}
You can’t perform that action at this time.
0 commit comments