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
18 changes: 9 additions & 9 deletions Gvisual/src/gvisual/AdjacencyMatrixHeatmap.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
*/
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 final Map<String, Map<String, Edge>> adjacency;
private int cellSize = 12;
private int offsetX = 0;
private int offsetY = 0;
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 @@ -192,7 +192,7 @@ public String getToolTipText(MouseEvent e) {
if (hoveredRow.equals(hoveredCol)) {
return "Node: " + hoveredRow + " (degree: " + graph.degree(hoveredRow) + ")";
}
Map<String, edge> rowMap = adjacency.get(hoveredRow);
Map<String, Edge> rowMap = adjacency.get(hoveredRow);
if (rowMap != null && rowMap.containsKey(hoveredCol)) {
edge ed = rowMap.get(hoveredCol);
String type = getEdgeTypeName(ed.getType());
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 @@ -269,7 +269,7 @@ protected void paintComponent(Graphics g2) {
int brightness = Math.min(255, 40 + deg * 15);
g.setColor(new Color(brightness, brightness, brightness));
} else {
Map<String, edge> rowMap = adjacency.get(nodeR);
Map<String, Edge> rowMap = adjacency.get(nodeR);
if (rowMap != null && rowMap.containsKey(nodeC)) {
edge e = rowMap.get(nodeC);
Color base = getEdgeColor(e);
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
20 changes: 10 additions & 10 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 @@ -52,7 +52,7 @@ public static class Bridge {
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 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 @@ -330,7 +330,7 @@ private void dfs(String u,
* Find the edge connecting two vertices.
*/
private edge findEdge(String u, String v) {
for (edge e : graph.getIncidentEdges(u)) {
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 @@ -414,7 +414,7 @@ private Set<String> bfsExcludingEdge(String start, edge excluded) {

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
24 changes: 12 additions & 12 deletions Gvisual/src/gvisual/ChordalGraphAnalyzer.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ public String toTextReport() {
* @param graph the graph
* @return MCS ordering (last eliminated first)
*/
public static List<String> maximumCardinalitySearch(Graph<String, edge> graph) {
public static List<String> maximumCardinalitySearch(Graph<String, Edge> graph) {
if (graph == null) return Collections.emptyList();
Collection<String> vertices = graph.getVertices();
if (vertices == null || vertices.isEmpty()) return Collections.emptyList();
Expand Down Expand Up @@ -247,7 +247,7 @@ public static List<String> maximumCardinalitySearch(Graph<String, edge> graph) {
* @param graph the graph
* @return ChordalityResult with PEO if chordal, or a chordless cycle if not
*/
public static ChordalityResult testChordality(Graph<String, edge> graph) {
public static ChordalityResult testChordality(Graph<String, Edge> graph) {
if (graph == null || graph.getVertexCount() == 0) {
return new ChordalityResult(true, Collections.<String>emptyList(), null);
}
Expand Down Expand Up @@ -349,7 +349,7 @@ private static List<String> findChordlessCycle(Map<String, Set<String>> adj,
* @param graph the graph
* @return coloring result
*/
public static ColoringResult optimalColoring(Graph<String, edge> graph) {
public static ColoringResult optimalColoring(Graph<String, Edge> graph) {
if (graph == null || graph.getVertexCount() == 0) {
return new ColoringResult(Collections.<String, Integer>emptyMap(), 0);
}
Expand Down Expand Up @@ -396,7 +396,7 @@ public static ColoringResult optimalColoring(Graph<String, edge> graph) {
* @param graph the graph
* @return vertices of a maximum clique
*/
public static Set<String> maximumClique(Graph<String, edge> graph) {
public static Set<String> maximumClique(Graph<String, Edge> graph) {
if (graph == null || graph.getVertexCount() == 0) {
return Collections.emptySet();
}
Expand Down Expand Up @@ -433,7 +433,7 @@ public static Set<String> maximumClique(Graph<String, edge> graph) {
return best;
}

private static Set<String> findMaxCliqueGreedy(Graph<String, edge> graph) {
private static Set<String> findMaxCliqueGreedy(Graph<String, Edge> graph) {
Map<String, Set<String>> adj = GraphUtils.buildAdjacencyMap(graph);
// Sort vertices by degree descending
List<String> sorted = new ArrayList<>(graph.getVertices());
Expand Down Expand Up @@ -467,7 +467,7 @@ private static Set<String> findMaxCliqueGreedy(Graph<String, edge> graph) {
* @param graph the graph
* @return list of maximal cliques
*/
public static List<Set<String>> allMaximalCliques(Graph<String, edge> graph) {
public static List<Set<String>> allMaximalCliques(Graph<String, Edge> graph) {
if (graph == null || graph.getVertexCount() == 0) {
return Collections.emptyList();
}
Expand Down Expand Up @@ -528,7 +528,7 @@ public static List<Set<String>> allMaximalCliques(Graph<String, edge> graph) {
* @param graph the graph
* @return list of clique tree nodes with neighbor relationships
*/
public static List<CliqueTreeNode> buildCliqueTree(Graph<String, edge> graph) {
public static List<CliqueTreeNode> buildCliqueTree(Graph<String, Edge> graph) {
List<Set<String>> cliques = allMaximalCliques(graph);
if (cliques.isEmpty()) return Collections.emptyList();

Expand Down Expand Up @@ -597,7 +597,7 @@ private static int intersectionSize(Set<String> a, Set<String> b) {
* @param graph the graph
* @return fill-in result with list of edges to add
*/
public static FillInResult computeFillIn(Graph<String, edge> graph) {
public static FillInResult computeFillIn(Graph<String, Edge> graph) {
if (graph == null || graph.getVertexCount() == 0) {
return new FillInResult(Collections.<String[]>emptyList());
}
Expand Down Expand Up @@ -656,7 +656,7 @@ public static FillInResult computeFillIn(Graph<String, edge> graph) {
* @param graph the graph
* @return list of minimal separators
*/
public static List<Set<String>> minimalSeparators(Graph<String, edge> graph) {
public static List<Set<String>> minimalSeparators(Graph<String, Edge> graph) {
List<Set<String>> cliques = allMaximalCliques(graph);
List<CliqueTreeNode> tree = buildCliqueTree(graph);
if (tree.size() <= 1) return Collections.emptyList();
Expand Down Expand Up @@ -684,7 +684,7 @@ public static List<Set<String>> minimalSeparators(Graph<String, edge> graph) {
* @param graph the graph
* @return treewidth, or -1 for empty graph
*/
public static int treewidth(Graph<String, edge> graph) {
public static int treewidth(Graph<String, Edge> graph) {
Set<String> mc = maximumClique(graph);
return mc.isEmpty() ? -1 : mc.size() - 1;
}
Expand All @@ -698,7 +698,7 @@ public static int treewidth(Graph<String, edge> graph) {
* @param order elimination order
* @return list of cliques formed at each elimination step
*/
public static List<Set<String>> eliminationCliques(Graph<String, edge> graph,
public static List<Set<String>> eliminationCliques(Graph<String, Edge> graph,
List<String> order) {
if (graph == null || order == null) return Collections.emptyList();

Expand Down Expand Up @@ -745,7 +745,7 @@ public static List<Set<String>> eliminationCliques(Graph<String, edge> graph,
* @param graph the graph
* @return full analysis report
*/
public static ChordalReport analyze(Graph<String, edge> graph) {
public static ChordalReport analyze(Graph<String, Edge> graph) {
int vc = graph != null ? graph.getVertexCount() : 0;
int ec = graph != null ? graph.getEdgeCount() : 0;

Expand Down
Loading
Loading