Skip to content
This repository was archived by the owner on Jun 18, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Gvisual/src/gvisual/AdjacencyMatrixHeatmap.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
public class AdjacencyMatrixHeatmap extends JPanel {

private final Graph<String, edge> graph;
private final Graph<String, Edge> graph;
private List<String> nodeOrder;
private final Map<String, Map<String, edge>> adjacency;
private int cellSize = 12;
Expand All @@ -49,7 +49,7 @@ public class AdjacencyMatrixHeatmap extends JPanel {
private static final Color HIGHLIGHT_COLOR = new Color(255, 255, 255, 40);
private static final Color LABEL_COLOR = new Color(200, 200, 200);

public AdjacencyMatrixHeatmap(Graph<String, edge> graph) {
public AdjacencyMatrixHeatmap(Graph<String, Edge> graph) {
this.graph = graph;
this.adjacency = new HashMap<>();
setBackground(BG_COLOR);
Expand All @@ -62,7 +62,7 @@ public AdjacencyMatrixHeatmap(Graph<String, edge> graph) {

private void buildAdjacency() {
adjacency.clear();
for (edge e : graph.getEdges()) {
for (Edge e : graph.getEdges()) {
String v1 = e.getVertex1();
String v2 = e.getVertex2();
adjacency.computeIfAbsent(v1, k -> new HashMap<>()).put(v2, e);
Expand Down Expand Up @@ -194,7 +194,7 @@ public String getToolTipText(MouseEvent e) {
}
Map<String, edge> rowMap = adjacency.get(hoveredRow);
if (rowMap != null && rowMap.containsKey(hoveredCol)) {
edge ed = rowMap.get(hoveredCol);
Edge ed = rowMap.get(hoveredCol);
String type = getEdgeTypeName(ed.getType());
String weight = ed.getWeight() != 0 ? ", weight: " + ed.getWeight() : "";
return hoveredRow + " ↔ " + hoveredCol + " [" + type + weight + "]";
Expand All @@ -216,7 +216,7 @@ private String getEdgeTypeName(String type) {
}
}

private Color getEdgeColor(edge e) {
private Color getEdgeColor(Edge e) {
if (e == null) return DEFAULT_COLOR;
String type = e.getType();
if (type == null) return DEFAULT_COLOR;
Expand Down Expand Up @@ -271,7 +271,7 @@ protected void paintComponent(Graphics g2) {
} else {
Map<String, edge> rowMap = adjacency.get(nodeR);
if (rowMap != null && rowMap.containsKey(nodeC)) {
edge e = rowMap.get(nodeC);
Edge e = rowMap.get(nodeC);
Color base = getEdgeColor(e);
float alpha = e.getWeight() > 0 ? Math.min(1f, 0.4f + e.getWeight() * 0.1f) : 0.85f;
g.setColor(new Color(base.getRed(), base.getGreen(), base.getBlue(),
Expand Down Expand Up @@ -347,7 +347,7 @@ protected void paintComponent(Graphics g2) {
};
for (int i = 0; i < legend.length; i++) {
int ly = legendY + 20 + i * 22;
edge dummy = new edge(legend[i][1], "", "");
Edge dummy = new Edge(legend[i][1], "", "");
g.setColor(getEdgeColor(dummy));
g.fillRect(legendX, ly - 10, 14, 14);
g.setColor(LABEL_COLOR);
Expand All @@ -366,7 +366,7 @@ protected void paintComponent(Graphics g2) {
/**
* Creates a dialog window containing the heatmap with controls.
*/
public static JDialog createDialog(JFrame parent, Graph<String, edge> graph) {
public static JDialog createDialog(JFrame parent, Graph<String, Edge> graph) {
JDialog dialog = new JDialog(parent, "Adjacency Matrix Heatmap", false);
dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

Expand Down
10 changes: 5 additions & 5 deletions Gvisual/src/gvisual/ArticulationPanelController.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ public class ArticulationPanelController {
private final JButton analyzeButton;
private final JButton clearButton;

private final Supplier<Graph<String, edge>> graphSupplier;
private final Supplier<Graph<String, Edge>> graphSupplier;
private final Runnable onOverlayChanged;

private boolean overlayActive;
private final Set<String> articulationPoints = new HashSet<>();
private final Set<edge> bridgeEdges = new HashSet<>();
private final Set<Edge> bridgeEdges = new HashSet<>();

/**
* @param graphSupplier supplies the current graph
* @param onOverlayChanged callback to refresh renderers/visualization after overlay changes
*/
public ArticulationPanelController(Supplier<Graph<String, edge>> graphSupplier,
public ArticulationPanelController(Supplier<Graph<String, Edge>> graphSupplier,
Runnable onOverlayChanged) {
this.graphSupplier = graphSupplier;
this.onOverlayChanged = onOverlayChanged;
Expand Down Expand Up @@ -78,10 +78,10 @@ public ArticulationPanelController(Supplier<Graph<String, edge>> graphSupplier,
public JPanel getPanel() { return panel; }
public boolean isOverlayActive() { return overlayActive; }
public Set<String> getArticulationPoints() { return Collections.unmodifiableSet(articulationPoints); }
public Set<edge> getBridgeEdges() { return Collections.unmodifiableSet(bridgeEdges); }
public Set<Edge> getBridgeEdges() { return Collections.unmodifiableSet(bridgeEdges); }

private void runAnalysis() {
Graph<String, edge> g = graphSupplier.get();
Graph<String, Edge> g = graphSupplier.get();
if (g == null || g.getVertexCount() == 0) {
summaryLabel.setText("<html>No graph loaded.</html>");
return;
Expand Down
32 changes: 16 additions & 16 deletions Gvisual/src/gvisual/ArticulationPointAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@
*/
public class ArticulationPointAnalyzer {

private final Graph<String, edge> graph;
private final Graph<String, Edge> graph;

/**
* Create a new analyzer for the given graph.
*
* @param graph the JUNG graph to analyze (must not be null)
* @throws IllegalArgumentException if graph is null
*/
public ArticulationPointAnalyzer(Graph<String, edge> graph) {
public ArticulationPointAnalyzer(Graph<String, Edge> graph) {
if (graph == null) {
throw new IllegalArgumentException("Graph must not be null");
}
Expand All @@ -46,13 +46,13 @@ public ArticulationPointAnalyzer(Graph<String, edge> graph) {
* A bridge (cut edge) whose removal disconnects the graph.
*/
public static class Bridge {
private final edge bridgeEdge;
private final Edge bridgeEdge;
private final String endpoint1;
private final String endpoint2;
private final int componentSizeA;
private final int componentSizeB;

public Bridge(edge bridgeEdge, String endpoint1, String endpoint2,
public Bridge(Edge bridgeEdge, String endpoint1, String endpoint2,
int componentSizeA, int componentSizeB) {
this.bridgeEdge = bridgeEdge;
this.endpoint1 = endpoint1;
Expand All @@ -62,7 +62,7 @@ public Bridge(edge bridgeEdge, String endpoint1, String endpoint2,
}

/** The bridge edge. */
public edge getEdge() { return bridgeEdge; }
public Edge getEdge() { return bridgeEdge; }
/** One endpoint. */
public String getEndpoint1() { return endpoint1; }
/** Other endpoint. */
Expand Down Expand Up @@ -227,7 +227,7 @@ public AnalysisResult analyze() {
Map<String, String> parent = new HashMap<String, String>();
Set<String> visited = new HashSet<String>();
Set<String> articulationPoints = new LinkedHashSet<String>();
List<edge> bridgeEdges = new ArrayList<edge>();
List<Edge> bridgeEdges = new ArrayList<Edge>();
int[] timer = {0};

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

// Build bridge details with component size estimation
List<Bridge> bridges = new ArrayList<Bridge>();
for (edge e : bridgeEdges) {
for (Edge e : bridgeEdges) {
String v1 = e.getVertex1() != null ? e.getVertex1() : findEndpoints(e)[0];
String v2 = e.getVertex2() != null ? e.getVertex2() : findEndpoints(e)[1];
int[] sizes = estimateComponentSizes(v1, v2, e);
Expand All @@ -284,7 +284,7 @@ private void dfs(String u,
Map<String, String> parent,
Set<String> visited,
Set<String> articulationPoints,
List<edge> bridges,
List<Edge> bridges,
int[] timer) {
visited.add(u);
disc.put(u, timer[0]);
Expand Down Expand Up @@ -314,7 +314,7 @@ private void dfs(String u,

// Bridge: low[v] > disc[u]
if (low.get(v) > disc.get(u)) {
edge bridgeEdge = findEdge(u, v);
Edge bridgeEdge = findEdge(u, v);
if (bridgeEdge != null) {
bridges.add(bridgeEdge);
}
Expand All @@ -329,8 +329,8 @@ private void dfs(String u,
/**
* Find the edge connecting two vertices.
*/
private edge findEdge(String u, String v) {
for (edge e : graph.getIncidentEdges(u)) {
private Edge findEdge(String u, String v) {
for (Edge e : graph.getIncidentEdges(u)) {
String v1 = e.getVertex1();
String v2 = e.getVertex2();
// Also check via JUNG endpoints since vertex1/vertex2 may be null
Expand All @@ -348,7 +348,7 @@ private edge findEdge(String u, String v) {
/**
* Find endpoints of an edge via the graph when vertex1/vertex2 may be null.
*/
private String[] findEndpoints(edge e) {
private String[] findEndpoints(Edge e) {
Collection<String> endpoints = graph.getEndpoints(e);
if (endpoints != null && endpoints.size() == 2) {
Iterator<String> it = endpoints.iterator();
Expand Down Expand Up @@ -396,7 +396,7 @@ private int countBiconnectedComponents(String vertex) {
* Estimate the sizes of the two components that would result from
* removing a bridge edge.
*/
private int[] estimateComponentSizes(String v1, String v2, edge bridgeEdge) {
private int[] estimateComponentSizes(String v1, String v2, Edge bridgeEdge) {
// BFS from v1, excluding the bridge edge
Set<String> comp1 = bfsExcludingEdge(v1, bridgeEdge);
Set<String> comp2 = bfsExcludingEdge(v2, bridgeEdge);
Expand All @@ -406,15 +406,15 @@ private int[] estimateComponentSizes(String v1, String v2, edge bridgeEdge) {
/**
* BFS from a start vertex, excluding a specific edge.
*/
private Set<String> bfsExcludingEdge(String start, edge excluded) {
private Set<String> bfsExcludingEdge(String start, Edge excluded) {
Set<String> visited = new HashSet<String>();
Queue<String> queue = new LinkedList<String>();
queue.add(start);
visited.add(start);

while (!queue.isEmpty()) {
String current = queue.poll();
for (edge e : graph.getIncidentEdges(current)) {
for (Edge e : graph.getIncidentEdges(current)) {
if (e == excluded) continue;
Collection<String> endpoints = graph.getEndpoints(e);
for (String neighbor : endpoints) {
Expand Down
4 changes: 2 additions & 2 deletions Gvisual/src/gvisual/BipartiteAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class BipartiteAnalyzer {
private static final String NIL = "__NIL__";
private static final int INF = Integer.MAX_VALUE;

private final Graph<String, edge> graph;
private final Graph<String, Edge> graph;
private Map<String, Integer> coloring;
private boolean bipartite;
private boolean computed;
Expand All @@ -45,7 +45,7 @@ public class BipartiteAnalyzer {
* @param graph the JUNG graph to analyze
* @throws IllegalArgumentException if graph is null
*/
public BipartiteAnalyzer(Graph<String, edge> graph) {
public BipartiteAnalyzer(Graph<String, Edge> graph) {
if (graph == null) {
throw new IllegalArgumentException("Graph must not be null");
}
Expand Down
6 changes: 3 additions & 3 deletions Gvisual/src/gvisual/CentralityPanelController.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ public class CentralityPanelController {
private final JButton computeButton;
private final JButton clearButton;

private final Supplier<Graph<String, edge>> graphSupplier;
private final Supplier<Graph<String, Edge>> graphSupplier;

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

public CentralityPanelController(Supplier<Graph<String, edge>> graphSupplier) {
public CentralityPanelController(Supplier<Graph<String, Edge>> graphSupplier) {
this.graphSupplier = graphSupplier;

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

private void runAnalysis() {
Graph<String, edge> g = graphSupplier.get();
Graph<String, Edge> g = graphSupplier.get();
if (g == null || g.getVertexCount() == 0) {
summaryLabel.setText("<html>No graph loaded.</html>");
return;
Expand Down
4 changes: 2 additions & 2 deletions Gvisual/src/gvisual/CentralityRadarExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@
*/
public class CentralityRadarExporter {

private final Graph<String, edge> graph;
private final Graph<String, Edge> graph;
private String title = "Centrality Radar Chart";

public CentralityRadarExporter(Graph<String, edge> graph) {
public CentralityRadarExporter(Graph<String, Edge> graph) {
if (graph == null) throw new IllegalArgumentException("Graph must not be null");
this.graph = graph;
}
Expand Down
Loading
Loading