From 01222c17291b0b94996555ab3e604f93a7f7a25d Mon Sep 17 00:00:00 2001
From: Saurav Bhattacharya The output path is validated to prevent directory traversal —
diff --git a/Gvisual/src/gvisual/AdjacencyMatrixHeatmap.java b/Gvisual/src/gvisual/AdjacencyMatrixHeatmap.java
index 8ce1273..c23e5c0 100644
--- a/Gvisual/src/gvisual/AdjacencyMatrixHeatmap.java
+++ b/Gvisual/src/gvisual/AdjacencyMatrixHeatmap.java
@@ -13,22 +13,22 @@
/**
* Adjacency matrix heatmap visualization for graphs.
* Displays the graph as a colored matrix where cell intensity represents
- * edge weight/presence, with edge-type color coding.
+ * Edge weight/presence, with Edge-type color coding.
*
* Features:
- * - Color-coded cells by edge type (friend, classmate, familiar stranger, etc.)
+ * - Color-coded cells by Edge type (friend, classmate, familiar stranger, etc.)
* - Zoom and pan controls
* - Node reordering by degree, name, or community
- * - Tooltip on hover showing node pair and edge details
+ * - Tooltip on hover showing node pair and Edge details
* - Export to PNG
*
* @author zalenix
*/
public class AdjacencyMatrixHeatmap extends JPanel {
- private final Graph An articulation point is a vertex whose removal disconnects
* the graph (or increases its number of connected components). A
- * bridge is an edge whose removal disconnects the graph. These are critical elements for network reliability analysis: A graph is chordal if every cycle of length ≥ 4 has a chord
- * (an edge joining two non-adjacent vertices in the cycle). Chordal graphs
+ * (an Edge joining two non-adjacent vertices in the cycle). Chordal graphs
* admit a perfect elimination ordering (PEO) — an ordering of
* vertices such that, for each vertex, its later neighbors form a clique. Places all vertices evenly around a circle, then optionally reorders
- * them to minimize edge crossings or group related nodes together:
@@ -25,7 +25,7 @@
*/
public class ArticulationPointAnalyzer {
- private final Graph
Algorithm
*
Usage:
*
- * Graph<String, edge> g = ...;
+ * Graph<String, Edge> g = ...;
* GraphAlgorithmAnimator animator = new GraphAlgorithmAnimator(g);
* List<AnimationFrame> frames = animator.animateBFS("A");
* for (AnimationFrame f : frames) {
@@ -38,7 +38,7 @@
*/
public class GraphAlgorithmAnimator {
- private final Graph graph;
+ private final Graph graph;
private final Map positions;
private final int defaultWidth;
private final int defaultHeight;
@@ -46,7 +46,7 @@ public class GraphAlgorithmAnimator {
// ── Color palette ─────────────────────────────────────────────
- /** Node/edge in default unvisited state. */
+ /** Node/Edge in default unvisited state. */
private static final String COLOR_UNVISITED = "#cbd5e1";
/** Node currently being processed. */
private static final String COLOR_CURRENT = "#ef4444";
@@ -109,7 +109,7 @@ public AnimationFrame(int stepNumber, String algorithmName,
*
* @param graph the graph to animate
*/
- public GraphAlgorithmAnimator(Graph graph) {
+ public GraphAlgorithmAnimator(Graph graph) {
this(graph, 800, 600, 18);
}
@@ -121,7 +121,7 @@ public GraphAlgorithmAnimator(Graph graph) {
* @param height SVG viewport height
* @param radius node circle radius
*/
- public GraphAlgorithmAnimator(Graph graph,
+ public GraphAlgorithmAnimator(Graph graph,
int width, int height, int radius) {
if (graph == null) throw new IllegalArgumentException("Graph must not be null");
this.graph = graph;
@@ -137,7 +137,7 @@ public GraphAlgorithmAnimator(Graph graph,
* @param graph the graph
* @param positions map of vertex to {x, y} positions
*/
- public GraphAlgorithmAnimator(Graph graph,
+ public GraphAlgorithmAnimator(Graph graph,
Map positions) {
this(graph, positions, 800, 600, 18);
}
@@ -145,7 +145,7 @@ public GraphAlgorithmAnimator(Graph graph,
/**
* Create an animator with pre-computed positions and custom dimensions.
*/
- public GraphAlgorithmAnimator(Graph graph,
+ public GraphAlgorithmAnimator(Graph graph,
Map positions,
int width, int height, int radius) {
if (graph == null) throw new IllegalArgumentException("Graph must not be null");
@@ -180,7 +180,7 @@ private AnimationState initState() {
s.nodeColors.put(v, COLOR_UNVISITED);
s.nodeLabels.put(v, v);
}
- for (edge e : graph.getEdges()) {
+ for (Edge e : graph.getEdges()) {
s.edgeColors.put(edgeKey(e), COLOR_UNVISITED);
}
return s;
@@ -222,7 +222,7 @@ public List animateBFS(String source) {
Collections.sort(neighbors);
for (String neighbor : neighbors) {
- edge e = findEdge(current, neighbor);
+ Edge e = findEdge(current, neighbor);
if (e != null) {
s.edgeColors.put(edgeKey(e), COLOR_ACTIVE_EDGE);
}
@@ -307,7 +307,7 @@ private void dfsRecurse(String current, Set visited,
for (String neighbor : neighbors) {
if (!visited.contains(neighbor)) {
- edge e = findEdge(current, neighbor);
+ Edge e = findEdge(current, neighbor);
if (e != null) {
s.edgeColors.put(edgeKey(e), COLOR_TREE_EDGE);
}
@@ -366,9 +366,9 @@ public List animateDijkstra(String source) {
finalized.add(u);
s.nodeColors.put(u, COLOR_CURRENT);
- // Highlight the tree edge to this node
+ // Highlight the tree Edge to this node
if (prev.containsKey(u)) {
- edge pe = findEdge(prev.get(u), u);
+ Edge pe = findEdge(prev.get(u), u);
if (pe != null) s.edgeColors.put(edgeKey(pe), COLOR_TREE_EDGE);
}
@@ -380,7 +380,7 @@ public List animateDijkstra(String source) {
for (String v : neighbors) {
if (finalized.contains(v)) continue;
- edge e = findEdge(u, v);
+ Edge e = findEdge(u, v);
double weight = (e != null) ? Math.max(e.getWeight(), 0.001) : 1.0;
double alt = dist.get(u) + weight;
@@ -427,8 +427,8 @@ public List animateKruskal() {
Map edgeLabelOverrides = new LinkedHashMap<>();
// Sort edges by weight
- List sortedEdges = new ArrayList<>(graph.getEdges());
- sortedEdges.sort(Comparator.comparingDouble(edge::getWeight));
+ List sortedEdges = new ArrayList<>(graph.getEdges());
+ sortedEdges.sort(Comparator.comparingDouble(Edge::getWeight));
// Union-Find
Map parent = new LinkedHashMap<>();
@@ -447,7 +447,7 @@ public List animateKruskal() {
int treeEdges = 0;
double totalWeight = 0;
- for (edge e : sortedEdges) {
+ for (Edge e : sortedEdges) {
String u = e.getVertex1();
String v = e.getVertex2();
String ek = edgeKey(e);
@@ -468,13 +468,13 @@ public List animateKruskal() {
totalWeight += e.getWeight();
frames.add(new AnimationFrame(step, "Kruskal",
- "Add edge " + u + "—" + v +
+ "Add Edge " + u + "—" + v +
" (w=" + String.format("%.1f", e.getWeight()) +
") — " + treeEdges + " tree edges",
s.nodeColors, s.edgeColors, s.nodeLabels, edgeLabelOverrides));
} else {
frames.add(new AnimationFrame(step, "Kruskal",
- "Skip edge " + u + "—" + v +
+ "Skip Edge " + u + "—" + v +
" (would create cycle)",
s.nodeColors, s.edgeColors, s.nodeLabels, edgeLabelOverrides));
s.edgeColors.put(ek, COLOR_UNVISITED);
@@ -614,7 +614,7 @@ public String toSVG(AnimationFrame frame, int width, int height) {
int offsetY = 60;
// Draw edges
- for (edge e : graph.getEdges()) {
+ for (Edge e : graph.getEdges()) {
String ek = edgeKey(e);
String color = frame.edgeColors.getOrDefault(ek, COLOR_UNVISITED);
double[] p1 = positions.get(e.getVertex1());
@@ -789,15 +789,15 @@ private void validateVertex(String v) {
}
}
- private String edgeKey(edge e) {
+ private String edgeKey(Edge e) {
if (e == null) return "";
String a = e.getVertex1();
String b = e.getVertex2();
return (a.compareTo(b) <= 0) ? a + "~~" + b : b + "~~" + a;
}
- private edge findEdge(String u, String v) {
- edge e = graph.findEdge(u, v);
+ private Edge findEdge(String u, String v) {
+ Edge e = graph.findEdge(u, v);
if (e == null) e = graph.findEdge(v, u);
return e;
}
@@ -858,7 +858,7 @@ private void union(Map parent,
* Compute a simple circular layout for the graph.
*/
private static Map computeLayout(
- Graph graph, int width, int height, int radius) {
+ Graph graph, int width, int height, int radius) {
Map pos = new LinkedHashMap<>();
List vertices = new ArrayList<>(graph.getVertices());
Collections.sort(vertices);
diff --git a/Gvisual/src/gvisual/GraphAnnotationManager.java b/Gvisual/src/gvisual/GraphAnnotationManager.java
index 0c8841b..7434c78 100644
--- a/Gvisual/src/gvisual/GraphAnnotationManager.java
+++ b/Gvisual/src/gvisual/GraphAnnotationManager.java
@@ -17,7 +17,7 @@
public class GraphAnnotationManager {
/**
- * Represents an annotation on a graph element (node or edge).
+ * Represents an annotation on a graph element (node or Edge).
*/
public static class Annotation {
private final String elementId;
@@ -142,7 +142,7 @@ public boolean removeNodeAnnotation(String nodeId) {
// --- Edge annotations ---
/**
- * Build a canonical edge ID from two vertices.
+ * Build a canonical Edge ID from two vertices.
*/
public static String edgeKey(String v1, String v2) {
if (v1.compareTo(v2) <= 0) return v1 + "--" + v2;
@@ -150,7 +150,7 @@ public static String edgeKey(String v1, String v2) {
}
/**
- * Annotate an edge by its endpoint vertices.
+ * Annotate an Edge by its endpoint vertices.
*/
public Annotation annotateEdge(String v1, String v2) {
String key = edgeKey(v1, v2);
@@ -159,14 +159,14 @@ public Annotation annotateEdge(String v1, String v2) {
}
/**
- * Get annotation for an edge, or null if none exists.
+ * Get annotation for an Edge, or null if none exists.
*/
public Annotation getEdgeAnnotation(String v1, String v2) {
return edgeAnnotations.get(edgeKey(v1, v2));
}
/**
- * Remove annotation from an edge.
+ * Remove annotation from an Edge.
*/
public boolean removeEdgeAnnotation(String v1, String v2) {
return edgeAnnotations.remove(edgeKey(v1, v2)) != null;
@@ -201,7 +201,7 @@ public int bulkColorNodes(Collection nodeIds, String color) {
// --- Search & filtering ---
/**
- * Find all annotations (node + edge) that have a specific tag.
+ * Find all annotations (node + Edge) that have a specific tag.
*/
public List findByTag(String tag) {
String normalizedTag = tag.trim().toLowerCase();
@@ -437,7 +437,7 @@ public int importFromJson(String json) {
String line = rawLine.trim();
if (line.contains("\"nodeAnnotations\"")) { currentSection = "node"; continue; }
- if (line.contains("\"edgeAnnotations\"")) { currentSection = "edge"; continue; }
+ if (line.contains("\"edgeAnnotations\"")) { currentSection = "Edge"; continue; }
if (line.equals("{") && currentSection != null) { inObject = true; continue; }
@@ -448,7 +448,7 @@ public int importFromJson(String json) {
if ("NODE".equals(elementType)) {
a = annotateNode(elementId);
} else {
- // Parse edge key "v1--v2"
+ // Parse Edge key "v1--v2"
String[] parts = elementId.split("--", 2);
if (parts.length == 2) {
a = annotateEdge(parts[0], parts[1]);
diff --git a/Gvisual/src/gvisual/GraphAnomalyDetector.java b/Gvisual/src/gvisual/GraphAnomalyDetector.java
index f0790ef..b2dbd94 100644
--- a/Gvisual/src/gvisual/GraphAnomalyDetector.java
+++ b/Gvisual/src/gvisual/GraphAnomalyDetector.java
@@ -12,7 +12,7 @@
* - Degree — number of connections (too many or too few)
* - Local clustering coefficient — how tightly connected a node's
* neighbors are (isolated vs. cliquish)
- * - Edge-type diversity — Shannon entropy across edge categories
+ *
- Edge-type diversity — Shannon entropy across Edge categories
* (concentrated vs. uniformly spread)
* - Neighbor degree deviation — how different a node's degree is
* from its neighbors' average (popularity mismatch)
@@ -49,7 +49,7 @@ public class GraphAnomalyDetector {
/** Number of metric dimensions. */
private static final int NUM_DIMENSIONS = 4;
- private final Graph graph;
+ private final Graph graph;
private List results;
private boolean analyzed;
@@ -71,7 +71,7 @@ public class GraphAnomalyDetector {
* @param graph the JUNG graph to analyze (must not be null)
* @throws IllegalArgumentException if graph is null
*/
- public GraphAnomalyDetector(Graph graph) {
+ public GraphAnomalyDetector(Graph graph) {
if (graph == null) {
throw new IllegalArgumentException("Graph must not be null");
}
@@ -415,24 +415,24 @@ private double computeClusteringCoeff(String v) {
}
}
}
- // Each triangle edge counted twice (once from each endpoint)
+ // Each triangle Edge counted twice (once from each endpoint)
triangleEdges /= 2;
return (2.0 * triangleEdges) / (k * (k - 1));
}
/**
- * Computes Shannon entropy of edge-type distribution for a node.
+ * Computes Shannon entropy of Edge-type distribution for a node.
* Higher entropy = more diverse connections across categories.
* Normalized to [0, 1] by dividing by log(numCategories).
*/
private double computeEdgeDiversity(String v) {
- Collection edges = graph.getIncidentEdges(v);
+ Collection edges = graph.getIncidentEdges(v);
if (edges == null || edges.isEmpty()) return 0.0;
Map typeCounts = new HashMap();
int total = 0;
- for (edge e : edges) {
+ for (Edge e : edges) {
String type = e.getType();
if (type == null) type = "unknown";
Integer count = typeCounts.get(type);
diff --git a/Gvisual/src/gvisual/GraphAsciiRenderer.java b/Gvisual/src/gvisual/GraphAsciiRenderer.java
index 644ecfc..390f056 100644
--- a/Gvisual/src/gvisual/GraphAsciiRenderer.java
+++ b/Gvisual/src/gvisual/GraphAsciiRenderer.java
@@ -13,7 +13,7 @@
* Features
*
* - Force-directed node placement on a text grid
- * - ASCII and Unicode box-drawing edge styles
+ * - ASCII and Unicode box-drawing Edge styles
* - Node labels with degree annotations
* - Configurable grid size (width × height in characters)
* - Edge weight display
@@ -39,7 +39,7 @@
*/
public class GraphAsciiRenderer {
- private final Graph graph;
+ private final Graph graph;
private int width = 100;
private int height = 35;
private boolean unicode = false;
@@ -74,7 +74,7 @@ public class GraphAsciiRenderer {
* @param graph the JUNG graph to render
* @throws IllegalArgumentException if graph is null
*/
- public GraphAsciiRenderer(Graph graph) {
+ public GraphAsciiRenderer(Graph graph) {
if (graph == null) {
throw new IllegalArgumentException("Graph must not be null");
}
@@ -103,7 +103,7 @@ public void setShowDegree(boolean showDegree) {
this.showDegree = showDegree;
}
- /** Show edge weight along edges. */
+ /** Show Edge weight along edges. */
public void setShowWeight(boolean showWeight) {
this.showWeight = showWeight;
}
@@ -161,7 +161,7 @@ public String render() {
for (char[] row : grid) Arrays.fill(row, SPACE);
// Draw edges
- for (edge e : graph.getEdges()) {
+ for (Edge e : graph.getEdges()) {
String v1 = e.getVertex1();
String v2 = e.getVertex2();
if (v1 == null || v2 == null) continue;
@@ -171,7 +171,7 @@ public String render() {
drawEdge(grid, p1[0], p1[1], p2[0], p2[1]);
}
- // Draw nodes (overwrite edge chars at node positions)
+ // Draw nodes (overwrite Edge chars at node positions)
for (String vertex : graph.getVertices()) {
int[] pos = gridPos.get(vertex);
if (pos == null) continue;
@@ -259,7 +259,7 @@ public String render() {
// Edge type distribution
Map typeCounts = new TreeMap<>();
- for (edge e : graph.getEdges()) {
+ for (Edge e : graph.getEdges()) {
String type = e.getType() != null ? e.getType() : "unknown";
typeCounts.merge(type, 1, Integer::sum);
}
@@ -388,7 +388,7 @@ private void computeLayout() {
// Build adjacency for quick lookup
Set edgeSet = new HashSet<>();
- for (edge e : graph.getEdges()) {
+ for (Edge e : graph.getEdges()) {
if (e.getVertex1() != null && e.getVertex2() != null) {
edgeSet.add(e.getVertex1() + "|" + e.getVertex2());
edgeSet.add(e.getVertex2() + "|" + e.getVertex1());
@@ -424,7 +424,7 @@ private void computeLayout() {
}
// Attractive forces along edges
- for (edge e : graph.getEdges()) {
+ for (Edge e : graph.getEdges()) {
String v1 = e.getVertex1();
String v2 = e.getVertex2();
if (v1 == null || v2 == null) continue;
diff --git a/Gvisual/src/gvisual/GraphBenchmarkSuite.java b/Gvisual/src/gvisual/GraphBenchmarkSuite.java
index 030609d..226ba4f 100644
--- a/Gvisual/src/gvisual/GraphBenchmarkSuite.java
+++ b/Gvisual/src/gvisual/GraphBenchmarkSuite.java
@@ -14,13 +14,13 @@ public class GraphBenchmarkSuite {
public static class BenchmarkGraph {
private final String name;
private final String description;
- private final Graph graph;
+ private final Graph graph;
private final int expectedNodes;
private final int expectedEdges;
private final Map properties;
public BenchmarkGraph(String name, String description,
- Graph graph,
+ Graph graph,
int expectedNodes, int expectedEdges,
Map properties) {
this.name = name;
@@ -33,7 +33,7 @@ public BenchmarkGraph(String name, String description,
public String getName() { return name; }
public String getDescription() { return description; }
- public Graph getGraph() { return graph; }
+ public Graph getGraph() { return graph; }
public int getExpectedNodes() { return expectedNodes; }
public int getExpectedEdges() { return expectedEdges; }
public Map getProperties() { return properties; }
@@ -59,10 +59,10 @@ public String getSummary() {
}
}
- private static void addEdge(Graph g, String v1, String v2) {
+ private static void addEdge(Graph g, String v1, String v2) {
if (!g.containsVertex(v1)) g.addVertex(v1);
if (!g.containsVertex(v2)) g.addVertex(v2);
- edge e = new edge("f", v1, v2);
+ Edge e = new Edge("f", v1, v2);
e.setLabel(v1 + "-" + v2);
g.addEdge(e, v1, v2);
}
@@ -74,7 +74,7 @@ private static Map props(String... pairs) {
}
public BenchmarkGraph zacharyKarateClub() {
- Graph g = new UndirectedSparseGraph();
+ Graph g = new UndirectedSparseGraph();
int[][] edges = {
{1,2},{1,3},{1,4},{1,5},{1,6},{1,7},{1,8},{1,9},{1,11},{1,12},
{1,13},{1,14},{1,18},{1,20},{1,22},{1,32},
@@ -95,7 +95,7 @@ public BenchmarkGraph zacharyKarateClub() {
}
public BenchmarkGraph petersenGraph() {
- Graph g = new UndirectedSparseGraph();
+ Graph g = new UndirectedSparseGraph();
int[][] edges = {{0,1},{1,2},{2,3},{3,4},{4,0},{5,7},{7,9},{9,6},{6,8},{8,5},{0,5},{1,6},{2,7},{3,8},{4,9}};
for (int[] p : edges) addEdge(g, String.valueOf(p[0]), String.valueOf(p[1]));
return new BenchmarkGraph("Petersen Graph",
@@ -104,7 +104,7 @@ public BenchmarkGraph petersenGraph() {
}
public BenchmarkGraph florentineFamilies() {
- Graph g = new UndirectedSparseGraph();
+ Graph g = new UndirectedSparseGraph();
String[][] edges = {
{"Medici","Barbadori"},{"Medici","Ridolfi"},{"Medici","Tornabuoni"},
{"Medici","Albizzi"},{"Medici","Salviati"},{"Medici","Acciaiuoli"},
@@ -122,7 +122,7 @@ public BenchmarkGraph florentineFamilies() {
}
public BenchmarkGraph cubeGraph() {
- Graph g = new UndirectedSparseGraph();
+ Graph g = new UndirectedSparseGraph();
int[][] edges = {{0,1},{0,2},{0,4},{1,3},{1,5},{2,3},{2,6},{3,7},{4,5},{4,6},{5,7},{6,7}};
for (int[] p : edges) {
String v1 = String.format("%03d", Integer.parseInt(Integer.toBinaryString(p[0])));
@@ -135,7 +135,7 @@ public BenchmarkGraph cubeGraph() {
}
public BenchmarkGraph dodecahedron() {
- Graph g = new UndirectedSparseGraph();
+ Graph g = new UndirectedSparseGraph();
int[][] edges = {
{1,2},{2,3},{3,4},{4,5},{5,1},{1,6},{2,7},{3,8},{4,9},{5,10},
{6,11},{6,15},{7,11},{7,12},{8,12},{8,13},{9,13},{9,14},{10,14},{10,15},
@@ -148,7 +148,7 @@ public BenchmarkGraph dodecahedron() {
}
public BenchmarkGraph tutteGraph() {
- Graph g = new UndirectedSparseGraph();
+ Graph g = new UndirectedSparseGraph();
int[][] edges = {
{1,2},{1,4},{1,26},
{2,3},{2,5},{3,4},{3,8},{4,29},
@@ -171,7 +171,7 @@ public BenchmarkGraph tutteGraph() {
public BenchmarkGraph friendshipGraph(int n) {
if (n < 1) throw new IllegalArgumentException("n must be >= 1");
- Graph g = new UndirectedSparseGraph();
+ Graph g = new UndirectedSparseGraph();
g.addVertex("0");
for (int i = 0; i < n; i++) {
String a = String.valueOf(2 * i + 1), b = String.valueOf(2 * i + 2);
diff --git a/Gvisual/src/gvisual/GraphCentralityCorrelator.java b/Gvisual/src/gvisual/GraphCentralityCorrelator.java
index 23757e2..4d9cc35 100644
--- a/Gvisual/src/gvisual/GraphCentralityCorrelator.java
+++ b/Gvisual/src/gvisual/GraphCentralityCorrelator.java
@@ -17,7 +17,7 @@
*/
public class GraphCentralityCorrelator {
- private final Graph graph;
+ private final Graph graph;
private final NodeCentralityAnalyzer centralityAnalyzer;
private boolean computed;
@@ -158,7 +158,7 @@ public int hashCode() {
* @param graph the JUNG graph to analyze
* @throws IllegalArgumentException if graph is null
*/
- public GraphCentralityCorrelator(Graph graph) {
+ public GraphCentralityCorrelator(Graph graph) {
if (graph == null) {
throw new IllegalArgumentException("Graph must not be null");
}
diff --git a/Gvisual/src/gvisual/GraphClusterQualityAnalyzer.java b/Gvisual/src/gvisual/GraphClusterQualityAnalyzer.java
index 235dc0c..5cc6ff9 100644
--- a/Gvisual/src/gvisual/GraphClusterQualityAnalyzer.java
+++ b/Gvisual/src/gvisual/GraphClusterQualityAnalyzer.java
@@ -15,7 +15,7 @@
* indicates significant community structure. Range: [-0.5, 1.0].
* - Coverage: Fraction of all edges that fall within clusters.
* Higher is better (all edges inside = 1.0).
- * - Conductance (per-cluster): Ratio of cut edges to total edge
+ *
- Conductance (per-cluster): Ratio of cut edges to total Edge
* boundary. Lower is better (fewer edges leaving the cluster).
* Minimum conductance reported as the worst-case cluster.
* - Normalized Cut (NCut): Sum of conductances across all clusters.
@@ -39,7 +39,7 @@
*
*
Usage
* {@code
- * Graph g = ...;
+ * Graph g = ...;
* Map clustering = new HashMap<>();
* clustering.put("A", 0);
* clustering.put("B", 0);
@@ -55,7 +55,7 @@
*/
public class GraphClusterQualityAnalyzer {
- private final Graph graph;
+ private final Graph graph;
/**
* Creates a new cluster quality analyzer for the given graph.
@@ -63,7 +63,7 @@ public class GraphClusterQualityAnalyzer {
* @param graph the JUNG graph whose clustering will be evaluated
* @throws IllegalArgumentException if graph is null
*/
- public GraphClusterQualityAnalyzer(Graph graph) {
+ public GraphClusterQualityAnalyzer(Graph graph) {
if (graph == null) {
throw new IllegalArgumentException("Graph must not be null");
}
@@ -264,7 +264,7 @@ public QualityReport evaluate(Map clustering) {
// Count intra-cluster and inter-cluster edges
int intraEdges = 0;
int interEdges = 0;
- for (edge e : graph.getEdges()) {
+ for (Edge e : graph.getEdges()) {
String v1 = e.getVertex1();
String v2 = e.getVertex2();
Integer c1 = clustering.get(v1);
@@ -307,10 +307,10 @@ public QualityReport evaluate(Map clustering) {
int totalDegree = 0;
for (String node : members) {
- Collection incidents = graph.getIncidentEdges(node);
+ Collection incidents = graph.getIncidentEdges(node);
if (incidents == null) continue;
totalDegree += incidents.size();
- for (edge e : incidents) {
+ for (Edge e : incidents) {
String neighbor = getOtherEnd(e, node);
Integer neighborCluster = clustering.get(neighbor);
if (neighborCluster != null && neighborCluster.equals(cid)) {
@@ -320,7 +320,7 @@ public QualityReport evaluate(Map clustering) {
}
}
}
- clusterIntra /= 2; // each intra-edge counted from both endpoints
+ clusterIntra /= 2; // each intra-Edge counted from both endpoints
// Conductance: cut / min(totalDegree, 2m - totalDegree)
double denom = Math.min(totalDegree, 2 * totalEdges - totalDegree);
@@ -540,10 +540,10 @@ private double computeModularity(
int clusterDegreeSum = 0;
for (String node : members) {
- Collection incidents = graph.getIncidentEdges(node);
+ Collection incidents = graph.getIncidentEdges(node);
if (incidents == null) continue;
clusterDegreeSum += incidents.size();
- for (edge e : incidents) {
+ for (Edge e : incidents) {
String neighbor = getOtherEnd(e, node);
if (members.contains(neighbor)) {
clusterIntra++;
@@ -584,7 +584,7 @@ private Map> invertClustering(Map clusteri
return result;
}
- private String getOtherEnd(edge e, String node) {
+ private String getOtherEnd(Edge e, String node) {
return e.getVertex1().equals(node) ? e.getVertex2() : e.getVertex1();
}
diff --git a/Gvisual/src/gvisual/GraphColoringAnalyzer.java b/Gvisual/src/gvisual/GraphColoringAnalyzer.java
index 5747dbd..26b4d8e 100644
--- a/Gvisual/src/gvisual/GraphColoringAnalyzer.java
+++ b/Gvisual/src/gvisual/GraphColoringAnalyzer.java
@@ -7,7 +7,7 @@
* Comprehensive graph coloring analyzer -- greedy coloring with multiple
* vertex orderings (natural, largest-first, smallest-last, DSatur),
* chromatic number bounds, k-colorability checking, coloring verification,
- * color class analysis, edge chromatic number estimation (Vizing's theorem),
+ * color class analysis, Edge chromatic number estimation (Vizing's theorem),
* and report generation.
*
* Graph coloring assigns labels (colors) to vertices so that no two
@@ -43,7 +43,7 @@ public enum VertexOrdering {
DSATUR
}
- private final Graph graph;
+ private final Graph graph;
/**
* Creates a new GraphColoringAnalyzer for the given graph.
@@ -51,7 +51,7 @@ public enum VertexOrdering {
* @param graph the JUNG graph to color
* @throws IllegalArgumentException if graph is null
*/
- public GraphColoringAnalyzer(Graph graph) {
+ public GraphColoringAnalyzer(Graph graph) {
if (graph == null) {
throw new IllegalArgumentException("Graph must not be null");
}
@@ -395,7 +395,7 @@ public List findConflicts(Map assignment) {
throw new IllegalArgumentException("Assignment must not be null");
}
List conflicts = new ArrayList<>();
- for (edge e : graph.getEdges()) {
+ for (Edge e : graph.getEdges()) {
String v1 = graph.getEndpoints(e).getFirst();
String v2 = graph.getEndpoints(e).getSecond();
Integer c1 = assignment.get(v1);
@@ -474,11 +474,11 @@ public Map analyzeColorClasses(ColoringResult result) {
// ── Edge Chromatic Number (Vizing's Theorem) ────────────────────
/**
- * Estimates the edge chromatic number bounds using Vizing's theorem.
- * For any simple graph, the edge chromatic number χ'(G) satisfies:
+ * Estimates the Edge chromatic number bounds using Vizing's theorem.
+ * For any simple graph, the Edge chromatic number χ'(G) satisfies:
* Δ(G) ≤ χ'(G) ≤ Δ(G) + 1, where Δ(G) is the maximum degree.
*
- * @return array with [lower bound, upper bound] for edge chromatic number
+ * @return array with [lower bound, upper bound] for Edge chromatic number
*/
public int[] edgeChromaticBounds() {
Collection vertices = graph.getVertices();
@@ -499,7 +499,7 @@ public int[] edgeChromaticBounds() {
/**
* Returns the maximum vertex degree (Δ), which is the Vizing lower
- * bound for the edge chromatic number.
+ * bound for the Edge chromatic number.
*
* @return maximum degree
*/
@@ -518,7 +518,7 @@ public int maxDegree() {
/**
* Generates a comprehensive coloring report including greedy and
- * DSatur results, chromatic bounds, edge chromatic bounds, and
+ * DSatur results, chromatic bounds, Edge chromatic bounds, and
* color class analysis.
*
* @return formatted report string
@@ -674,7 +674,7 @@ private Map> buildColorClasses(
}
private boolean validate(Map assignment) {
- for (edge e : graph.getEdges()) {
+ for (Edge e : graph.getEdges()) {
String v1 = graph.getEndpoints(e).getFirst();
String v2 = graph.getEndpoints(e).getSecond();
Integer c1 = assignment.get(v1);
diff --git a/Gvisual/src/gvisual/GraphComplementAnalyzer.java b/Gvisual/src/gvisual/GraphComplementAnalyzer.java
index c5ee91a..2248df2 100644
--- a/Gvisual/src/gvisual/GraphComplementAnalyzer.java
+++ b/Gvisual/src/gvisual/GraphComplementAnalyzer.java
@@ -8,7 +8,7 @@
* Computes the complement graph of a given graph and provides comparative
* analysis between the original and its complement.
*
- * The complement G' of a graph G has the same vertices, but an edge exists in G'
+ *
The complement G' of a graph G has the same vertices, but an Edge exists in G'
* if and only if it does not exist in G. This is useful for understanding
* graph density, identifying missing connections, and studying structural properties
* that become apparent when relationships are inverted.
@@ -16,7 +16,7 @@
* Features
*
* - Build the complement graph as a new JUNG UndirectedSparseGraph
- * - Compare edge counts, density, and degree distributions
+ * - Compare Edge counts, density, and degree distributions
* - Identify vertices whose degree changes most dramatically
* - Check self-complementarity (isomorphism with complement)
* - Export a textual comparison report
@@ -34,8 +34,8 @@ private GraphComplementAnalyzer() { /* utility class */ }
* @param graph the original graph
* @return a new graph containing all edges not present in the original
*/
- public static Graph buildComplement(Graph graph) {
- UndirectedSparseGraph complement = new UndirectedSparseGraph<>();
+ public static Graph buildComplement(Graph graph) {
+ UndirectedSparseGraph complement = new UndirectedSparseGraph<>();
List vertices = new ArrayList<>(graph.getVertices());
for (String v : vertices) {
@@ -43,7 +43,7 @@ public static Graph buildComplement(Graph graph) {
}
Set existingEdges = new HashSet<>();
- for (edge e : graph.getEdges()) {
+ for (Edge e : graph.getEdges()) {
String v1 = e.getVertex1();
String v2 = e.getVertex2();
existingEdges.add(edgeKey(v1, v2));
@@ -55,7 +55,7 @@ public static Graph buildComplement(Graph graph) {
String v1 = vertices.get(i);
String v2 = vertices.get(j);
if (!existingEdges.contains(edgeKey(v1, v2))) {
- edge e = new edge(v1, v2, "complement_" + edgeId++);
+ Edge e = new Edge(v1, v2, "complement_" + edgeId++);
complement.addEdge(e, v1, v2);
}
}
@@ -71,8 +71,8 @@ public static Graph buildComplement(Graph graph) {
* @param graph the original graph
* @return a formatted analysis report string
*/
- public static String analyze(Graph graph) {
- Graph complement = buildComplement(graph);
+ public static String analyze(Graph graph) {
+ Graph complement = buildComplement(graph);
int n = graph.getVertexCount();
int origEdges = graph.getEdgeCount();
int compEdges = complement.getEdgeCount();
@@ -98,18 +98,18 @@ public static String analyze(Graph graph) {
sb.append(String.format(" Avg degree: %.2f%n", avgDegree(complement)));
sb.append("\n");
- // Verify edge counts sum correctly
+ // Verify Edge counts sum correctly
sb.append("── Validation ─────────────────────────────\n");
sb.append(" Orig + Complement: ").append(origEdges + compEdges).append("\n");
sb.append(" Expected (n*(n-1)/2):").append(maxEdges).append("\n");
sb.append(" Valid: ").append(origEdges + compEdges == maxEdges ? "✓" : "✗").append("\n\n");
- // Self-complementary check (quick heuristic: edge count must equal n*(n-1)/4)
+ // Self-complementary check (quick heuristic: Edge count must equal n*(n-1)/4)
boolean couldBeSelfComplementary = (maxEdges % 2 == 0) && (origEdges == maxEdges / 2);
sb.append("── Self-Complementary ─────────────────────\n");
sb.append(" Edge-count test: ").append(couldBeSelfComplementary ? "PASS (possible)" : "FAIL").append("\n");
if (couldBeSelfComplementary) {
- sb.append(" (Full isomorphism check not performed — edge count is necessary but not sufficient)\n");
+ sb.append(" (Full isomorphism check not performed — Edge count is necessary but not sufficient)\n");
}
sb.append("\n");
@@ -139,15 +139,15 @@ public static String analyze(Graph graph) {
}
/**
- * Returns the complement graph's edge list as a list of string pairs.
+ * Returns the complement graph's Edge list as a list of string pairs.
*
* @param graph the original graph
* @return list of [vertex1, vertex2] arrays representing complement edges
*/
- public static List getComplementEdgeList(Graph graph) {
- Graph complement = buildComplement(graph);
+ public static List getComplementEdgeList(Graph graph) {
+ Graph complement = buildComplement(graph);
List result = new ArrayList<>();
- for (edge e : complement.getEdges()) {
+ for (Edge e : complement.getEdges()) {
result.add(new String[]{e.getVertex1(), e.getVertex2()});
}
return result;
@@ -164,7 +164,7 @@ private static double density(int edges, int vertices) {
return (2.0 * edges) / (vertices * (vertices - 1));
}
- private static double avgDegree(Graph g) {
+ private static double avgDegree(Graph g) {
if (g.getVertexCount() == 0) return 0.0;
double sum = 0;
for (String v : g.getVertices()) {
@@ -174,7 +174,7 @@ private static double avgDegree(Graph g) {
}
private static List computeDegreeChanges(
- Graph orig, Graph comp) {
+ Graph orig, Graph comp) {
List list = new ArrayList<>();
for (String v : orig.getVertices()) {
int od = orig.degree(v);
diff --git a/Gvisual/src/gvisual/GraphCompressor.java b/Gvisual/src/gvisual/GraphCompressor.java
index 352a646..a2d380e 100644
--- a/Gvisual/src/gvisual/GraphCompressor.java
+++ b/Gvisual/src/gvisual/GraphCompressor.java
@@ -49,7 +49,7 @@
*/
public class GraphCompressor {
- private final Graph graph;
+ private final Graph graph;
/**
* Creates a compressor for the given graph.
@@ -57,7 +57,7 @@ public class GraphCompressor {
* @param graph the graph to compress (must not be null)
* @throws IllegalArgumentException if graph is null
*/
- public GraphCompressor(Graph graph) {
+ public GraphCompressor(Graph graph) {
if (graph == null) {
throw new IllegalArgumentException("Graph must not be null");
}
@@ -289,7 +289,7 @@ public String compressibilityReport() {
// ── Quotient Graph Builder ──────────────────────────────────────
private CompressionResult buildQuotientGraph(List> groups, String strategy) {
- Graph quotient = new UndirectedSparseGraph<>();
+ Graph quotient = new UndirectedSparseGraph<>();
Map> supernodeMembers = new LinkedHashMap<>();
Map nodeToSupernode = new HashMap<>();
@@ -314,7 +314,7 @@ private CompressionResult buildQuotientGraph(List> groups, String s
int edgeCounter = 0;
Map superEdgeInfos = new HashMap<>();
- for (edge e : graph.getEdges()) {
+ for (Edge e : graph.getEdges()) {
String v1 = graph.getEndpoints(e).getFirst();
String v2 = graph.getEndpoints(e).getSecond();
String s1 = nodeToSupernode.get(v1);
@@ -328,10 +328,10 @@ private CompressionResult buildQuotientGraph(List> groups, String s
info = new SuperEdgeInfo();
superEdgeInfos.put(edgeKey, info);
- edge superEdge = new edge("super", s1, s2);
+ Edge superEdge = new Edge("super", s1, s2);
superEdge.setLabel("compressed");
quotient.addEdge(superEdge, s1, s2);
- info.edge = superEdge;
+ info.Edge = superEdge;
}
info.count++;
info.totalWeight += e.getWeight();
@@ -339,7 +339,7 @@ private CompressionResult buildQuotientGraph(List> groups, String s
// Set aggregated weights
for (SuperEdgeInfo info : superEdgeInfos.values()) {
- info.edge.setWeight(info.totalWeight);
+ info.Edge.setWeight(info.totalWeight);
}
return new CompressionResult(
@@ -359,7 +359,7 @@ private static double jaccardSimilarity(Set a, Set b) {
}
private String formatReportLine(String label, CompressionResult result) {
- return String.format(" %-30s → %d supernodes, %d edges (%.1f%% node reduction, %.1f%% edge reduction)\n",
+ return String.format(" %-30s → %d supernodes, %d edges (%.1f%% node reduction, %.1f%% Edge reduction)\n",
label,
result.getCompressedNodeCount(),
result.getCompressedEdgeCount(),
@@ -368,7 +368,7 @@ private String formatReportLine(String label, CompressionResult result) {
}
private static class SuperEdgeInfo {
- edge edge;
+ Edge Edge;
int count;
float totalWeight;
}
@@ -380,14 +380,14 @@ private static class SuperEdgeInfo {
* graph, supernode membership mappings, and compression statistics.
*/
public static class CompressionResult {
- private final Graph original;
- private final Graph compressed;
+ private final Graph original;
+ private final Graph compressed;
private final Map> supernodeMembers;
private final Map nodeToSupernode;
private final String strategy;
- CompressionResult(Graph original,
- Graph compressed,
+ CompressionResult(Graph original,
+ Graph compressed,
Map> supernodeMembers,
Map nodeToSupernode,
String strategy) {
@@ -399,7 +399,7 @@ public static class CompressionResult {
}
/** Returns the compressed quotient graph. */
- public Graph getCompressedGraph() { return compressed; }
+ public Graph getCompressedGraph() { return compressed; }
/** Returns a map from supernode ID to its member node IDs. */
public Map> getSupernodeMembers() { return supernodeMembers; }
@@ -413,13 +413,13 @@ public static class CompressionResult {
/** Original node count. */
public int getOriginalNodeCount() { return original.getVertexCount(); }
- /** Original edge count. */
+ /** Original Edge count. */
public int getOriginalEdgeCount() { return original.getEdgeCount(); }
/** Compressed node count. */
public int getCompressedNodeCount() { return compressed.getVertexCount(); }
- /** Compressed edge count. */
+ /** Compressed Edge count. */
public int getCompressedEdgeCount() { return compressed.getEdgeCount(); }
/** Compression ratio (compressed/original nodes). */
diff --git a/Gvisual/src/gvisual/GraphDiameterAnalyzer.java b/Gvisual/src/gvisual/GraphDiameterAnalyzer.java
index aa28883..65473dd 100644
--- a/Gvisual/src/gvisual/GraphDiameterAnalyzer.java
+++ b/Gvisual/src/gvisual/GraphDiameterAnalyzer.java
@@ -23,7 +23,7 @@
*/
public class GraphDiameterAnalyzer {
- private final Graph graph;
+ private final Graph graph;
private Map eccentricities;
private int diameter;
private int radius;
@@ -38,7 +38,7 @@ public class GraphDiameterAnalyzer {
* @param graph the JUNG graph to analyze
* @throws IllegalArgumentException if graph is null
*/
- public GraphDiameterAnalyzer(Graph graph) {
+ public GraphDiameterAnalyzer(Graph graph) {
if (graph == null) {
throw new IllegalArgumentException("Graph must not be null");
}
@@ -216,7 +216,7 @@ private Set findLargestComponent() {
return GraphUtils.findLargestComponent(graph);
}
- private String getOtherEnd(edge e, String current) {
+ private String getOtherEnd(Edge e, String current) {
return GraphUtils.getOtherEnd(e, current);
}
diff --git a/Gvisual/src/gvisual/GraphDiffAnalyzer.java b/Gvisual/src/gvisual/GraphDiffAnalyzer.java
index 14314e9..fc4538a 100644
--- a/Gvisual/src/gvisual/GraphDiffAnalyzer.java
+++ b/Gvisual/src/gvisual/GraphDiffAnalyzer.java
@@ -28,8 +28,8 @@
*/
public class GraphDiffAnalyzer {
- private final Graph graphA;
- private final Graph graphB;
+ private final Graph graphA;
+ private final Graph graphB;
/**
* Create a diff analyzer comparing graphA (baseline) to graphB (target).
@@ -38,7 +38,7 @@ public class GraphDiffAnalyzer {
* @param graphB the target graph to compare against
* @throws IllegalArgumentException if either graph is null
*/
- public GraphDiffAnalyzer(Graph graphA, Graph graphB) {
+ public GraphDiffAnalyzer(Graph graphA, Graph graphB) {
if (graphA == null || graphB == null) {
throw new IllegalArgumentException("Both graphs must not be null");
}
@@ -51,7 +51,7 @@ public GraphDiffAnalyzer(Graph graphA, Graph graphB)
/**
* Holds the complete diff result between two graphs.
*
- * Includes node/edge differences, similarity metrics, edit distance,
+ * Includes node/Edge differences, similarity metrics, edit distance,
* and degree changes — all computed in a single pass by
* {@link GraphDiffAnalyzer#computeDiff()}.
*/
@@ -105,7 +105,7 @@ public DiffResult(Set addedNodes, Set removedNodes,
/** Jaccard similarity of node sets: |A∩B| / |A∪B|. */
public double getNodeJaccard() { return nodeJaccard; }
- /** Jaccard similarity of edge sets: |A∩B| / |A∪B|. */
+ /** Jaccard similarity of Edge sets: |A∩B| / |A∪B|. */
public double getEdgeJaccard() { return edgeJaccard; }
/**
@@ -149,7 +149,7 @@ public String getSummary() {
}
/**
- * Represents an edge for diff purposes (endpoint pair, normalized order
+ * Represents an Edge for diff purposes (endpoint pair, normalized order
* for undirected comparison).
*/
public static class EdgeDiff {
@@ -196,7 +196,7 @@ public String toString() {
/**
* Compute the full diff between graphA and graphB.
*
- * This single call computes all node/edge differences, Jaccard
+ * This single call computes all node/Edge differences, Jaccard
* similarity, edit distance, and degree changes. Use the returned
* {@link DiffResult} to access everything — there is no need to call
* {@link #findDegreeChanges()} or {@link #computeEditDistance()}
@@ -270,7 +270,7 @@ public Map findDegreeChanges() {
}
/**
- * Compute the edit distance: total node/edge additions + removals
+ * Compute the edit distance: total node/Edge additions + removals
* needed to transform A into B.
*
* Convenience method — delegates to {@link #computeDiff()} internally.
@@ -285,9 +285,9 @@ public int computeEditDistance() {
// ── Helpers ─────────────────────────────────────────────────
- private Set extractEdges(Graph g) {
+ private Set extractEdges(Graph g) {
Set edges = new HashSet<>();
- for (edge e : g.getEdges()) {
+ for (Edge e : g.getEdges()) {
Collection endpoints = g.getEndpoints(e);
if (endpoints != null && endpoints.size() == 2) {
Iterator it = endpoints.iterator();
diff --git a/Gvisual/src/gvisual/GraphDiffHtmlExporter.java b/Gvisual/src/gvisual/GraphDiffHtmlExporter.java
index e99570a..929e956 100644
--- a/Gvisual/src/gvisual/GraphDiffHtmlExporter.java
+++ b/Gvisual/src/gvisual/GraphDiffHtmlExporter.java
@@ -34,8 +34,8 @@
*/
public class GraphDiffHtmlExporter {
- private final Graph graphA;
- private final Graph graphB;
+ private final Graph graphA;
+ private final Graph graphB;
private String title = "Graph Diff Visualization";
private String labelA = "Graph A";
private String labelB = "Graph B";
@@ -43,7 +43,7 @@ public class GraphDiffHtmlExporter {
private int width = 1200;
private int height = 700;
- public GraphDiffHtmlExporter(Graph graphA, Graph graphB) {
+ public GraphDiffHtmlExporter(Graph graphA, Graph graphB) {
if (graphA == null || graphB == null) {
throw new IllegalArgumentException("Both graphs must not be null");
}
diff --git a/Gvisual/src/gvisual/GraphDistanceDistribution.java b/Gvisual/src/gvisual/GraphDistanceDistribution.java
index 2c5d875..cd270a9 100644
--- a/Gvisual/src/gvisual/GraphDistanceDistribution.java
+++ b/Gvisual/src/gvisual/GraphDistanceDistribution.java
@@ -21,14 +21,14 @@
* - Text report — human-readable distance distribution summary
*
*
- * All computations use unweighted BFS. For directed graphs the out-edge
+ *
All computations use unweighted BFS. For directed graphs the out-Edge
* direction is followed. Distance to self is 0, unreachable pairs use -1.
*
* @author zalenix
*/
public class GraphDistanceDistribution {
- private final Graph graph;
+ private final Graph graph;
private Map> distanceMatrix;
private boolean computed;
@@ -38,7 +38,7 @@ public class GraphDistanceDistribution {
* @param graph the JUNG graph to analyse
* @throws IllegalArgumentException if graph is null
*/
- public GraphDistanceDistribution(Graph graph) {
+ public GraphDistanceDistribution(Graph graph) {
if (graph == null) {
throw new IllegalArgumentException("Graph must not be null");
}
diff --git a/Gvisual/src/gvisual/GraphEntropyAnalyzer.java b/Gvisual/src/gvisual/GraphEntropyAnalyzer.java
index 7104449..aa653ad 100644
--- a/Gvisual/src/gvisual/GraphEntropyAnalyzer.java
+++ b/Gvisual/src/gvisual/GraphEntropyAnalyzer.java
@@ -18,14 +18,14 @@
* set of neighbour degree values. Captures local structural
* diversity around each node.
* - Edge type entropy — Shannon entropy over the distribution of
- * edge categories (friend, classmate, etc.). Measures diversity
+ * Edge categories (friend, classmate, etc.). Measures diversity
* of relationship types in the network.
* - Topological information content — based on degree-sequence
* equivalence classes (orbits under automorphism approximation).
* Measures how much information is needed to distinguish nodes.
* - Random walk entropy rate — the asymptotic entropy per step
* of a random walker on the graph, H = log2(2m) - (1/2m) Σ d(v) log2 d(v),
- * where d(v) is the degree of vertex v and m is the edge count.
+ * where d(v) is the degree of vertex v and m is the Edge count.
* - Chromatic entropy — entropy based on vertex coloring using
* greedy coloring (largest-first), measuring color distribution
* uniformity.
@@ -53,7 +53,7 @@ public class GraphEntropyAnalyzer {
private static final double EPSILON = 1e-12;
private static final int JACOBI_MAX_SWEEPS = 100;
- private final Graph graph;
+ private final Graph graph;
private boolean computed;
// ── Results ─────────────────────────────────────────────────────
@@ -68,7 +68,7 @@ public class GraphEntropyAnalyzer {
private double avgNeighbourhoodEntropy;
private String complexityClass;
- public GraphEntropyAnalyzer(Graph graph) {
+ public GraphEntropyAnalyzer(Graph graph) {
this.graph = Objects.requireNonNull(graph, "graph must not be null");
this.computed = false;
this.neighbourhoodEntropy = new LinkedHashMap<>();
@@ -244,14 +244,14 @@ private void computeNeighbourhoodEntropy() {
}
/**
- * Shannon entropy over edge type distribution.
+ * Shannon entropy over Edge type distribution.
*/
private void computeEdgeTypeEntropy() {
int m = graph.getEdgeCount();
if (m == 0) { edgeTypeEntropy = 0; return; }
Map freq = new HashMap<>();
- for (edge e : graph.getEdges()) {
+ for (Edge e : graph.getEdges()) {
String type = e.getType();
if (type == null) type = "unknown";
Integer old = freq.get(type);
@@ -479,7 +479,7 @@ private double[][] buildLaplacian() {
for (int i = 0; i < n; i++) idx.put(vList.get(i), i);
double[][] L = new double[n][n];
- for (edge e : graph.getEdges()) {
+ for (Edge e : graph.getEdges()) {
String v1 = graph.getEndpoints(e).getFirst();
String v2 = graph.getEndpoints(e).getSecond();
int i = idx.get(v1);
@@ -615,7 +615,7 @@ public String generateReport() {
sb.append(" * High Von Neumann entropy suggests complex, well-connected structure.\n");
}
if (edgeTypeEntropy > 1.0) {
- sb.append(" * High edge type entropy indicates diverse relationship types.\n");
+ sb.append(" * High Edge type entropy indicates diverse relationship types.\n");
}
if (degreeCCMutualInfo > 0.5) {
sb.append(" * Significant degree-CC mutual information: degree strongly predicts clustering.\n");
diff --git a/Gvisual/src/gvisual/GraphFileParser.java b/Gvisual/src/gvisual/GraphFileParser.java
index 3138641..3c43608 100644
--- a/Gvisual/src/gvisual/GraphFileParser.java
+++ b/Gvisual/src/gvisual/GraphFileParser.java
@@ -13,7 +13,7 @@
/**
* Parses a graph definition file (nodes + edges) into a JUNG graph and
- * classified edge lists.
+ * classified Edge lists.
*
* Extracted from {@link Main#addGraph()} to separate file I/O and
* parsing logic from Swing UI construction. This makes the parsing
@@ -31,24 +31,24 @@
* CL B C 2.0
*
*
- * Each edge line: {@code Useful for testing analysis algorithms, benchmarking performance,
* exploring graph properties, and creating example networks for
* demonstrations. All generated graphs use the same JUNG graph type
- * ({@code UndirectedSparseGraph
Each possible edge is included independently with probability + *
Each possible Edge is included independently with probability * {@code p}. When p=0, no edges are created; when p=1, a complete * graph results.
* * @param n number of nodes (must be >= 1) - * @param p edge probability between 0.0 and 1.0 + * @param p Edge probability between 0.0 and 1.0 * @return the generated random graph * @throws IllegalArgumentException if n < 1 or p is out of range */ public GeneratedGraph randomErdosRenyi(int n, double p) { if (n < 1) throw new IllegalArgumentException("n must be >= 1"); if (p < 0.0 || p > 1.0) throw new IllegalArgumentException("p must be in [0, 1]"); - GraphStarts with a ring lattice where each node is connected to * its {@code k} nearest neighbors (k/2 on each side), then - * rewires each edge with probability {@code beta}. Low beta + * rewires each Edge with probability {@code beta}. Low beta * produces regular lattices; high beta produces random graphs; * intermediate values create the "small-world" property * (high clustering + short path lengths).
@@ -471,7 +471,7 @@ public GeneratedGraph smallWorldWs(int n, int k, double beta) { if (k >= n) throw new IllegalArgumentException("k must be < n"); if (beta < 0.0 || beta > 1.0) throw new IllegalArgumentException("beta must be in [0, 1]"); - GraphEdges only connect nodes in group A to nodes in group B - * (never within the same group). Each possible cross-group edge + * (never within the same group). Each possible cross-group Edge * is included with probability {@code p}.
* * @param groupASize size of group A (must be >= 1) * @param groupBSize size of group B (must be >= 1) - * @param p edge probability between 0.0 and 1.0 + * @param p Edge probability between 0.0 and 1.0 * @return the generated bipartite graph * @throws IllegalArgumentException if group sizes < 1 or p is invalid */ @@ -535,7 +535,7 @@ public GeneratedGraph bipartite(int groupASize, int groupBSize, double p) { if (p < 0.0 || p > 1.0) throw new IllegalArgumentException("p must be in [0, 1]"); - GraphTwo graphs G1 and G2 are isomorphic if there exists a - * bijection f: V(G1) → V(G2) such that (u, v) is an edge in G1 - * if and only if (f(u), f(v)) is an edge in G2.
+ * bijection f: V(G1) → V(G2) such that (u, v) is an Edge in G1 + * if and only if (f(u), f(v)) is an Edge in G2. * *Uses a multi-stage approach:
** MergeResult result = GraphMerger.merge(graphA, graphB, Strategy.UNION, * EdgeConflict.AVERAGE); - * Graph<String, edge> merged = result.getMergedGraph(); + * Graph<String, Edge> merged = result.getMergedGraph(); ** * @author zalenix @@ -56,7 +56,7 @@ public enum Strategy { RIGHT_JOIN } - /** Edge conflict resolution when the same edge pair exists in both graphs. */ + /** Edge conflict resolution when the same Edge pair exists in both graphs. */ public enum EdgeConflict { /** Keep weight from graph A. */ KEEP_LEFT, @@ -76,7 +76,7 @@ public enum EdgeConflict { * Result of a merge operation, including the merged graph and statistics. */ public static final class MergeResult { - private final Graph