Skip to content
This repository was archived by the owner on Jun 18, 2026. It is now read-only.

Commit 7656e2d

Browse files
refactor: use GraphUtils.buildAdjacencyMap() in GraphColoringAnalyzer (#74)
Replace inline adjacency map construction in smallestLastOrder() with the shared GraphUtils.buildAdjacencyMap() utility, eliminating ~10 lines of duplicated code. Part of #43
1 parent 93b3a16 commit 7656e2d

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

Gvisual/src/gvisual/GraphColoringAnalyzer.java

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -602,19 +602,8 @@ private List<String> getOrderedVertices(VertexOrdering ordering) {
602602
* minimum-degree vertex from the remaining graph, then reverse.
603603
*/
604604
private List<String> smallestLastOrder() {
605-
// Build adjacency for the subgraph
606605
Set<String> remaining = new HashSet<>(graph.getVertices());
607-
Map<String, Set<String>> adj = new HashMap<>();
608-
for (String v : remaining) {
609-
Set<String> neighbors = new HashSet<>();
610-
Collection<String> n = graph.getNeighbors(v);
611-
if (n != null) {
612-
for (String nb : n) {
613-
neighbors.add(nb);
614-
}
615-
}
616-
adj.put(v, neighbors);
617-
}
606+
Map<String, Set<String>> adj = GraphUtils.buildAdjacencyMap(graph);
618607

619608
List<String> order = new ArrayList<>();
620609
while (!remaining.isEmpty()) {

0 commit comments

Comments
 (0)