Skip to content

Commit 7a15429

Browse files
committed
Remove main method
1 parent 895c810 commit 7a15429

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

src/main/java/com/thealgorithms/datastructures/graphs/FloydWarshall.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -83,39 +83,6 @@ private void printDistanceMatrix() {
8383
}
8484
}
8585

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-
11986
public Object[] getDistanceMatrix() {
12087
return distanceMatrix;
12188
}

0 commit comments

Comments
 (0)