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

Commit 9128dd1

Browse files
refactor: rename edge class to Edge (Java naming convention)
Rename the edge class to Edge to follow Java PascalCase naming conventions. Update all 208 files referencing the class as a type parameter, variable type, or constructor call. No behavioral changes. Fixes #89
1 parent e7a2803 commit 9128dd1

208 files changed

Lines changed: 3120 additions & 3120 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gvisual/src/gvisual/AdjacencyMatrixHeatmap.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
*/
2727
public class AdjacencyMatrixHeatmap extends JPanel {
2828

29-
private final Graph<String, edge> graph;
29+
private final Graph<String, Edge> graph;
3030
private List<String> nodeOrder;
31-
private final Map<String, Map<String, edge>> adjacency;
31+
private final Map<String, Map<String, Edge>> adjacency;
3232
private int cellSize = 12;
3333
private int offsetX = 0;
3434
private int offsetY = 0;
@@ -49,7 +49,7 @@ public class AdjacencyMatrixHeatmap extends JPanel {
4949
private static final Color HIGHLIGHT_COLOR = new Color(255, 255, 255, 40);
5050
private static final Color LABEL_COLOR = new Color(200, 200, 200);
5151

52-
public AdjacencyMatrixHeatmap(Graph<String, edge> graph) {
52+
public AdjacencyMatrixHeatmap(Graph<String, Edge> graph) {
5353
this.graph = graph;
5454
this.adjacency = new HashMap<>();
5555
setBackground(BG_COLOR);
@@ -62,7 +62,7 @@ public AdjacencyMatrixHeatmap(Graph<String, edge> graph) {
6262

6363
private void buildAdjacency() {
6464
adjacency.clear();
65-
for (edge e : graph.getEdges()) {
65+
for (Edge e : graph.getEdges()) {
6666
String v1 = e.getVertex1();
6767
String v2 = e.getVertex2();
6868
adjacency.computeIfAbsent(v1, k -> new HashMap<>()).put(v2, e);
@@ -192,9 +192,9 @@ public String getToolTipText(MouseEvent e) {
192192
if (hoveredRow.equals(hoveredCol)) {
193193
return "Node: " + hoveredRow + " (degree: " + graph.degree(hoveredRow) + ")";
194194
}
195-
Map<String, edge> rowMap = adjacency.get(hoveredRow);
195+
Map<String, Edge> rowMap = adjacency.get(hoveredRow);
196196
if (rowMap != null && rowMap.containsKey(hoveredCol)) {
197-
edge ed = rowMap.get(hoveredCol);
197+
Edge ed = rowMap.get(hoveredCol);
198198
String type = getEdgeTypeName(ed.getType());
199199
String weight = ed.getWeight() != 0 ? ", weight: " + ed.getWeight() : "";
200200
return hoveredRow + " ↔ " + hoveredCol + " [" + type + weight + "]";
@@ -216,7 +216,7 @@ private String getEdgeTypeName(String type) {
216216
}
217217
}
218218

219-
private Color getEdgeColor(edge e) {
219+
private Color getEdgeColor(Edge e) {
220220
if (e == null) return DEFAULT_COLOR;
221221
String type = e.getType();
222222
if (type == null) return DEFAULT_COLOR;
@@ -269,9 +269,9 @@ protected void paintComponent(Graphics g2) {
269269
int brightness = Math.min(255, 40 + deg * 15);
270270
g.setColor(new Color(brightness, brightness, brightness));
271271
} else {
272-
Map<String, edge> rowMap = adjacency.get(nodeR);
272+
Map<String, Edge> rowMap = adjacency.get(nodeR);
273273
if (rowMap != null && rowMap.containsKey(nodeC)) {
274-
edge e = rowMap.get(nodeC);
274+
Edge e = rowMap.get(nodeC);
275275
Color base = getEdgeColor(e);
276276
float alpha = e.getWeight() > 0 ? Math.min(1f, 0.4f + e.getWeight() * 0.1f) : 0.85f;
277277
g.setColor(new Color(base.getRed(), base.getGreen(), base.getBlue(),
@@ -347,7 +347,7 @@ protected void paintComponent(Graphics g2) {
347347
};
348348
for (int i = 0; i < legend.length; i++) {
349349
int ly = legendY + 20 + i * 22;
350-
edge dummy = new edge(legend[i][1], "", "");
350+
Edge dummy = new Edge(legend[i][1], "", "");
351351
g.setColor(getEdgeColor(dummy));
352352
g.fillRect(legendX, ly - 10, 14, 14);
353353
g.setColor(LABEL_COLOR);
@@ -366,7 +366,7 @@ protected void paintComponent(Graphics g2) {
366366
/**
367367
* Creates a dialog window containing the heatmap with controls.
368368
*/
369-
public static JDialog createDialog(JFrame parent, Graph<String, edge> graph) {
369+
public static JDialog createDialog(JFrame parent, Graph<String, Edge> graph) {
370370
JDialog dialog = new JDialog(parent, "Adjacency Matrix Heatmap", false);
371371
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
372372

Gvisual/src/gvisual/ArticulationPanelController.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ public class ArticulationPanelController {
2222
private final JButton analyzeButton;
2323
private final JButton clearButton;
2424

25-
private final Supplier<Graph<String, edge>> graphSupplier;
25+
private final Supplier<Graph<String, Edge>> graphSupplier;
2626
private final Runnable onOverlayChanged;
2727

2828
private boolean overlayActive;
2929
private final Set<String> articulationPoints = new HashSet<>();
30-
private final Set<edge> bridgeEdges = new HashSet<>();
30+
private final Set<Edge> bridgeEdges = new HashSet<>();
3131

3232
/**
3333
* @param graphSupplier supplies the current graph
3434
* @param onOverlayChanged callback to refresh renderers/visualization after overlay changes
3535
*/
36-
public ArticulationPanelController(Supplier<Graph<String, edge>> graphSupplier,
36+
public ArticulationPanelController(Supplier<Graph<String, Edge>> graphSupplier,
3737
Runnable onOverlayChanged) {
3838
this.graphSupplier = graphSupplier;
3939
this.onOverlayChanged = onOverlayChanged;
@@ -78,10 +78,10 @@ public ArticulationPanelController(Supplier<Graph<String, edge>> graphSupplier,
7878
public JPanel getPanel() { return panel; }
7979
public boolean isOverlayActive() { return overlayActive; }
8080
public Set<String> getArticulationPoints() { return Collections.unmodifiableSet(articulationPoints); }
81-
public Set<edge> getBridgeEdges() { return Collections.unmodifiableSet(bridgeEdges); }
81+
public Set<Edge> getBridgeEdges() { return Collections.unmodifiableSet(bridgeEdges); }
8282

8383
private void runAnalysis() {
84-
Graph<String, edge> g = graphSupplier.get();
84+
Graph<String, Edge> g = graphSupplier.get();
8585
if (g == null || g.getVertexCount() == 0) {
8686
summaryLabel.setText("<html>No graph loaded.</html>");
8787
return;

Gvisual/src/gvisual/ArticulationPointAnalyzer.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@
2525
*/
2626
public class ArticulationPointAnalyzer {
2727

28-
private final Graph<String, edge> graph;
28+
private final Graph<String, Edge> graph;
2929

3030
/**
3131
* Create a new analyzer for the given graph.
3232
*
3333
* @param graph the JUNG graph to analyze (must not be null)
3434
* @throws IllegalArgumentException if graph is null
3535
*/
36-
public ArticulationPointAnalyzer(Graph<String, edge> graph) {
36+
public ArticulationPointAnalyzer(Graph<String, Edge> graph) {
3737
if (graph == null) {
3838
throw new IllegalArgumentException("Graph must not be null");
3939
}
@@ -46,13 +46,13 @@ public ArticulationPointAnalyzer(Graph<String, edge> graph) {
4646
* A bridge (cut edge) whose removal disconnects the graph.
4747
*/
4848
public static class Bridge {
49-
private final edge bridgeEdge;
49+
private final Edge bridgeEdge;
5050
private final String endpoint1;
5151
private final String endpoint2;
5252
private final int componentSizeA;
5353
private final int componentSizeB;
5454

55-
public Bridge(edge bridgeEdge, String endpoint1, String endpoint2,
55+
public Bridge(Edge bridgeEdge, String endpoint1, String endpoint2,
5656
int componentSizeA, int componentSizeB) {
5757
this.bridgeEdge = bridgeEdge;
5858
this.endpoint1 = endpoint1;
@@ -62,7 +62,7 @@ public Bridge(edge bridgeEdge, String endpoint1, String endpoint2,
6262
}
6363

6464
/** The bridge edge. */
65-
public edge getEdge() { return bridgeEdge; }
65+
public Edge getEdge() { return bridgeEdge; }
6666
/** One endpoint. */
6767
public String getEndpoint1() { return endpoint1; }
6868
/** Other endpoint. */
@@ -227,7 +227,7 @@ public AnalysisResult analyze() {
227227
Map<String, String> parent = new HashMap<String, String>();
228228
Set<String> visited = new HashSet<String>();
229229
Set<String> articulationPoints = new LinkedHashSet<String>();
230-
List<edge> bridgeEdges = new ArrayList<edge>();
230+
List<Edge> bridgeEdges = new ArrayList<Edge>();
231231
int[] timer = {0};
232232

233233
// Run DFS from each unvisited vertex (handles disconnected graphs)
@@ -245,7 +245,7 @@ public AnalysisResult analyze() {
245245
for (String ap : articulationPoints) {
246246
int degree = graph.degree(ap);
247247
Map<String, Integer> edgeTypeCounts = new HashMap<String, Integer>();
248-
for (edge e : graph.getIncidentEdges(ap)) {
248+
for (Edge e : graph.getIncidentEdges(ap)) {
249249
String type = e.getType() != null ? e.getType() : "unknown";
250250
edgeTypeCounts.put(type, edgeTypeCounts.getOrDefault(type, 0) + 1);
251251
}
@@ -260,7 +260,7 @@ public AnalysisResult analyze() {
260260

261261
// Build bridge details with component size estimation
262262
List<Bridge> bridges = new ArrayList<Bridge>();
263-
for (edge e : bridgeEdges) {
263+
for (Edge e : bridgeEdges) {
264264
String v1 = e.getVertex1() != null ? e.getVertex1() : findEndpoints(e)[0];
265265
String v2 = e.getVertex2() != null ? e.getVertex2() : findEndpoints(e)[1];
266266
int[] sizes = estimateComponentSizes(v1, v2, e);
@@ -284,7 +284,7 @@ private void dfs(String u,
284284
Map<String, String> parent,
285285
Set<String> visited,
286286
Set<String> articulationPoints,
287-
List<edge> bridges,
287+
List<Edge> bridges,
288288
int[] timer) {
289289
visited.add(u);
290290
disc.put(u, timer[0]);
@@ -314,7 +314,7 @@ private void dfs(String u,
314314

315315
// Bridge: low[v] > disc[u]
316316
if (low.get(v) > disc.get(u)) {
317-
edge bridgeEdge = findEdge(u, v);
317+
Edge bridgeEdge = findEdge(u, v);
318318
if (bridgeEdge != null) {
319319
bridges.add(bridgeEdge);
320320
}
@@ -329,8 +329,8 @@ private void dfs(String u,
329329
/**
330330
* Find the edge connecting two vertices.
331331
*/
332-
private edge findEdge(String u, String v) {
333-
for (edge e : graph.getIncidentEdges(u)) {
332+
private Edge findEdge(String u, String v) {
333+
for (Edge e : graph.getIncidentEdges(u)) {
334334
String v1 = e.getVertex1();
335335
String v2 = e.getVertex2();
336336
// Also check via JUNG endpoints since vertex1/vertex2 may be null
@@ -348,7 +348,7 @@ private edge findEdge(String u, String v) {
348348
/**
349349
* Find endpoints of an edge via the graph when vertex1/vertex2 may be null.
350350
*/
351-
private String[] findEndpoints(edge e) {
351+
private String[] findEndpoints(Edge e) {
352352
Collection<String> endpoints = graph.getEndpoints(e);
353353
if (endpoints != null && endpoints.size() == 2) {
354354
Iterator<String> it = endpoints.iterator();
@@ -396,7 +396,7 @@ private int countBiconnectedComponents(String vertex) {
396396
* Estimate the sizes of the two components that would result from
397397
* removing a bridge edge.
398398
*/
399-
private int[] estimateComponentSizes(String v1, String v2, edge bridgeEdge) {
399+
private int[] estimateComponentSizes(String v1, String v2, Edge bridgeEdge) {
400400
// BFS from v1, excluding the bridge edge
401401
Set<String> comp1 = bfsExcludingEdge(v1, bridgeEdge);
402402
Set<String> comp2 = bfsExcludingEdge(v2, bridgeEdge);
@@ -406,15 +406,15 @@ private int[] estimateComponentSizes(String v1, String v2, edge bridgeEdge) {
406406
/**
407407
* BFS from a start vertex, excluding a specific edge.
408408
*/
409-
private Set<String> bfsExcludingEdge(String start, edge excluded) {
409+
private Set<String> bfsExcludingEdge(String start, Edge excluded) {
410410
Set<String> visited = new HashSet<String>();
411411
Queue<String> queue = new LinkedList<String>();
412412
queue.add(start);
413413
visited.add(start);
414414

415415
while (!queue.isEmpty()) {
416416
String current = queue.poll();
417-
for (edge e : graph.getIncidentEdges(current)) {
417+
for (Edge e : graph.getIncidentEdges(current)) {
418418
if (e == excluded) continue;
419419
Collection<String> endpoints = graph.getEndpoints(e);
420420
for (String neighbor : endpoints) {

Gvisual/src/gvisual/BipartiteAnalyzer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public class BipartiteAnalyzer {
3333
private static final String NIL = "__NIL__";
3434
private static final int INF = Integer.MAX_VALUE;
3535

36-
private final Graph<String, edge> graph;
36+
private final Graph<String, Edge> graph;
3737
private Map<String, Integer> coloring;
3838
private boolean bipartite;
3939
private boolean computed;
@@ -45,7 +45,7 @@ public class BipartiteAnalyzer {
4545
* @param graph the JUNG graph to analyze
4646
* @throws IllegalArgumentException if graph is null
4747
*/
48-
public BipartiteAnalyzer(Graph<String, edge> graph) {
48+
public BipartiteAnalyzer(Graph<String, Edge> graph) {
4949
if (graph == null) {
5050
throw new IllegalArgumentException("Graph must not be null");
5151
}

Gvisual/src/gvisual/CentralityPanelController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ public class CentralityPanelController {
2424
private final JButton computeButton;
2525
private final JButton clearButton;
2626

27-
private final Supplier<Graph<String, edge>> graphSupplier;
27+
private final Supplier<Graph<String, Edge>> graphSupplier;
2828

2929
private boolean active;
3030
private final Map<String, NodeCentralityAnalyzer.CentralityResult> results = new HashMap<>();
3131

32-
public CentralityPanelController(Supplier<Graph<String, edge>> graphSupplier) {
32+
public CentralityPanelController(Supplier<Graph<String, Edge>> graphSupplier) {
3333
this.graphSupplier = graphSupplier;
3434

3535
Font labelFont = new Font("SansSerif", Font.PLAIN, 12);
@@ -106,7 +106,7 @@ public Map<String, NodeCentralityAnalyzer.CentralityResult> getResults() {
106106
}
107107

108108
private void runAnalysis() {
109-
Graph<String, edge> g = graphSupplier.get();
109+
Graph<String, Edge> g = graphSupplier.get();
110110
if (g == null || g.getVertexCount() == 0) {
111111
summaryLabel.setText("<html>No graph loaded.</html>");
112112
return;

Gvisual/src/gvisual/CentralityRadarExporter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@
3333
*/
3434
public class CentralityRadarExporter {
3535

36-
private final Graph<String, edge> graph;
36+
private final Graph<String, Edge> graph;
3737
private String title = "Centrality Radar Chart";
3838

39-
public CentralityRadarExporter(Graph<String, edge> graph) {
39+
public CentralityRadarExporter(Graph<String, Edge> graph) {
4040
if (graph == null) throw new IllegalArgumentException("Graph must not be null");
4141
this.graph = graph;
4242
}

0 commit comments

Comments
 (0)