Sets an edge in the adjacency matrix @param from source node (1-indexed) @param to destination node (1-indexed) @param value 1 if edge exists, 0 otherwise
(int from, int to, int value)
| 90 | * @param value 1 if edge exists, 0 otherwise |
| 91 | */ |
| 92 | public void setEdge(int from, int to, int value) { |
| 93 | if (from == to) { |
| 94 | adjacencyMatrix[from][to] = 0; // No self-loops |
| 95 | } else { |
| 96 | adjacencyMatrix[from][to] = value; |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Sets the adjacency matrix for the graph |
no outgoing calls