(String filePath)
| 142 | } |
| 143 | |
| 144 | private static SimpleGraph<Integer> readGraph(String filePath) { |
| 145 | SimpleGraph<Integer> graph = new SimpleGraph<>(); |
| 146 | try { |
| 147 | Files.readAllLines(Path.of(filePath)).forEach(line -> { |
| 148 | String[] split = line.split("->"); |
| 149 | int source = Integer.parseInt(split[0]); |
| 150 | int target = Integer.parseInt(split[1]); |
| 151 | graph.addEdge(source, target); |
| 152 | }); |
| 153 | } catch (IOException e) { |
| 154 | throw new RuntimeException("Failed to read " + filePath + |
| 155 | " due to " + e); |
| 156 | } |
| 157 | return graph; |
| 158 | } |
| 159 | } |
no test coverage detected