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

Commit aeaf441

Browse files
author
Zalenix
committed
docs(algorithms): document 19 missing analyzers + add Transformation & Special-Classes sections
ALGORITHMS.md was missing entries for nearly a third of the implemented analyzers (the running gap between code and docs had grown to 19 of 58 classes). Filled in: KTruss, RichClub, Bipartite, CliqueCover, PerfectGraph, SmallWorld, GraphRegularity, GraphNeighborhood, GraphLabeling, MetricDimension, GraphSymmetry, GraphDrawingQuality, GraphClusterQuality, NodeSimilarity, LineGraph, GraphComplement, GraphMinor, GraphSparsification, Tournament. Added two new top-level categories (Graph Transformation & Construction, Special Graph Classes) so transformation/special-class analyzers have a natural home instead of being orphaned. Updated TOC and refreshed the complexity-summary table to include the new categories and the previously-missed analyzers (small-world, regularity, perfect, etc.). Each new entry follows the established schema: file, complexity, algorithm description with citations to underlying theorems (Konig, Strong Perfect Graph Theorem, Watts-Strogatz, etc.), and use cases.
1 parent 3d6772f commit aeaf441

1 file changed

Lines changed: 131 additions & 3 deletions

File tree

ALGORITHMS.md

Lines changed: 131 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ A comprehensive reference for all graph algorithms implemented in GraphVisual, o
1515
- [Structural Analysis](#structural-analysis)
1616
- [Comparison & Evolution](#comparison--evolution)
1717
- [Stochastic & Prediction](#stochastic--prediction)
18+
- [Graph Transformation & Construction](#graph-transformation--construction)
19+
- [Special Graph Classes](#special-graph-classes)
1820
- [Export & Generation](#export--generation)
1921

2022
---
@@ -117,6 +119,18 @@ A comprehensive reference for all graph algorithms implemented in GraphVisual, o
117119
- **Complexity:** O(V + E)
118120
- **Algorithm:** Finds maximal subsets of vertices where every vertex is reachable from every other vertex (in directed graphs). Used for condensation DAG construction.
119121

122+
### K-Truss Decomposition
123+
- **File:** `KTrussAnalyzer.java`
124+
- **Complexity:** O(m · t_max) edge-peeling, where m = |E| and t_max is the maximum truss number
125+
- **Algorithm:** Iteratively removes edges whose triangle support drops below (k − 2) and assigns each removed edge its highest surviving k. A k-truss is a maximal subgraph in which every edge belongs to at least (k − 2) triangles, giving a more cohesive notion of community than k-core. Returns the truss number per edge, the hierarchy of (k+1)-truss ⊂ k-truss subgraphs, and the global maximum truss.
126+
- **Use cases:** Cohesive subgroup detection in social networks, robust community cores, hierarchical clustering by triangle density.
127+
128+
### Rich-Club Analysis
129+
- **File:** `RichClubAnalyzer.java`
130+
- **Complexity:** O(V + E) per coefficient; O(R · (V + E)) for normalisation with R randomised rewirings
131+
- **Algorithm:** Computes the rich-club coefficient φ(k) = 2·E>k / (N>k·(N>k − 1)), the density of edges among nodes of degree > k. A rich-club ordering occurs when φ(k) increases with k. Normalised coefficient ρ(k) = φ(k) / φ_rand(k) is obtained by degree-preserving random rewiring of the input graph; ρ(k) > 1 indicates a genuine rich-club beyond what degree distribution alone explains.
132+
- **Use cases:** Hub-of-hubs detection in air-traffic and brain networks, identifying preferential interconnection among elite nodes, distinguishing real rich-clubs from degree-sequence artefacts.
133+
120134
### Graph Resilience (Attack Simulation)
121135
- **File:** `GraphResilienceAnalyzer.java`
122136
- **Complexity:** O(V × (V + E))
@@ -136,6 +150,18 @@ A comprehensive reference for all graph algorithms implemented in GraphVisual, o
136150
- **Complexity:** O(E × √V)
137151
- **Algorithm:** For bipartite graphs: BFS layering + DFS augmenting paths. Also computes minimum vertex cover (König's theorem) and maximum independent set (complement of vertex cover).
138152

153+
### Bipartite Detection & Analysis (BFS 2-colouring)
154+
- **File:** `BipartiteAnalyzer.java`
155+
- **Complexity:** O(V + E) for bipartiteness; cached Hopcroft–Karp matching reused across queries
156+
- **Algorithm:** BFS 2-colouring across all components determines bipartiteness and yields the left/right partition. On a positive result the cached Hopcroft–Karp matching feeds König-based minimum vertex cover and maximum independent set. On a negative result, an odd-cycle witness is reported for diagnostics.
157+
- **Use cases:** Assignment problems, scheduling, recommendation graphs, bipartite community detection, fast acceptance tests before invoking bipartite-only algorithms.
158+
159+
### Clique Cover (Clique Partition)
160+
- **File:** `CliqueCoverAnalyzer.java`
161+
- **Complexity:** NP-hard exact; O(V³ · E) greedy heuristic; θ(G) = χ(Ḡ)
162+
- **Algorithm:** Partitions vertices into the minimum number of vertex-disjoint cliques. Uses the duality θ(G) = χ(Ḡ) (chromatic number of the complement) for a lower bound, plus a greedy heuristic that repeatedly extracts the largest clique containing the least-covered vertex. Returns the partition, per-clique sizes, and quality vs the lower bound.
163+
- **Use cases:** Compact graph encoding, register-allocation analogues, scheduling problems where vertices must share a clique, complement-based colouring.
164+
139165
### Minimum Vertex Cover (Greedy Approximation)
140166
- **File:** `VertexCoverAnalyzer.java`
141167
- **Complexity:** O(V + E) for 2-approximation
@@ -165,6 +191,12 @@ A comprehensive reference for all graph algorithms implemented in GraphVisual, o
165191
- **Complexity:** O(V + E) for recognition
166192
- **Algorithm:** Maximum cardinality search (MCS) for perfect elimination ordering (PEO). If a PEO exists, the graph is chordal. Provides optimal coloring, maximum clique, and minimum fill-in for chordal graphs.
167193

194+
### Perfect Graph Analysis
195+
- **File:** `PerfectGraphAnalyzer.java`
196+
- **Complexity:** O(V⁵) brute-force odd-hole search (small graphs); polynomial recognition for known sub-classes (bipartite, chordal)
197+
- **Algorithm:** A graph is *perfect* iff χ(H) = ω(H) for every induced subgraph H. By the Strong Perfect Graph Theorem (Chudnovsky–Robertson–Seymour–Thomas, 2006), this holds iff neither G nor Ḡ contains an odd hole (induced odd cycle ≥ 5). Searches for odd holes in G and the complement, reports witness cycles, and recognises common perfect sub-classes (bipartite, chordal, comparability) for fast positive answers.
198+
- **Use cases:** Polynomial-time colouring and clique algorithms whenever perfection is established, theoretical analysis of social and scheduling graphs.
199+
168200
### Planarity Testing
169201
- **File:** `PlanarGraphAnalyzer.java`
170202
- **Complexity:** O(V + E)
@@ -258,6 +290,54 @@ A comprehensive reference for all graph algorithms implemented in GraphVisual, o
258290
- **Complexity:** O(V + E)
259291
- **Algorithm:** Structural balance theory — checks if a signed graph (positive/negative edges) satisfies balance conditions. Detects frustrated cycles and computes frustration index.
260292

293+
### Small-World Network Analysis
294+
- **File:** `SmallWorldAnalyzer.java`
295+
- **Complexity:** O(V·(V + E)) (BFS from each vertex for average path length dominates)
296+
- **Algorithm:** Tests Watts–Strogatz small-world properties by combining local/global clustering coefficients and characteristic path length against random and lattice baselines. Reports σ = (C/Cr)/(L/Lr) and ω = Lr/L − C/Cl, then classifies the network as Small-World, Random-Like, Lattice-Like, or Disconnected. Handles disconnected graphs by restricting path-length computations to the largest connected component.
297+
- **Use cases:** Diagnosing brain-network and social-network topologies, validating synthetic generators, comparing temporal snapshots.
298+
299+
### Graph Regularity
300+
- **File:** `GraphRegularityAnalyzer.java`
301+
- **Complexity:** O(V + E)
302+
- **Algorithm:** Determines whether a graph is k-regular and quantifies departure from regularity. Computes the Albertson irregularity index Σ|deg(u) − deg(v)| over edges, degree variance, and the maximum/minimum degree gap. Identifies strongly-regular candidates by checking common neighbour counts for adjacent vs non-adjacent pairs.
303+
- **Use cases:** Detection of structured topologies (rings, lattices, cages), null-model construction, sanity-checking synthetic generators.
304+
305+
### k-Hop Neighbourhood Analysis
306+
- **File:** `GraphNeighborhoodAnalyzer.java`
307+
- **Complexity:** O(k · (V + E)) per source for BFS layers
308+
- **Algorithm:** BFS expansion from a source vertex producing the sequence of k-hop layers, the cumulative reachable set, and the growth profile |N_k| / |N_{k−1}|. Aggregates per-vertex 1-hop neighbour-degree statistics (mean, variance) used downstream by entropy and similarity analyzers.
309+
- **Use cases:** Influence radius estimation, locality-sensitive features for link prediction, ego-network construction.
310+
311+
### Graph Labeling
312+
- **File:** `GraphLabelingAnalyzer.java`
313+
- **Complexity:** O(V! · E) worst-case backtracking; feasible for V ≤ ≈ 20
314+
- **Algorithm:** Backtracking search with pruning for graph-labeling problems — primarily *graceful labeling* (vertices labelled 0..m so that edge labels |f(u) − f(v)| are exactly {1..m}). Also computes magic-labeling candidates and reports the first feasible labeling discovered.
315+
- **Use cases:** Combinatorial design verification, exam-scheduling toy models, teaching examples for NP-hard search.
316+
317+
### Metric Dimension
318+
- **File:** `MetricDimensionAnalyzer.java`
319+
- **Complexity:** NP-hard exact (subset enumeration with pruning); O(V·(V + E)) per inner BFS
320+
- **Algorithm:** Finds the minimum *resolving set* — a subset S ⊆ V such that the distance vector (d(v, s))_{s∈S} is unique for every v. Uses incremental subset search with twin-vertex pruning (twins must be separated). Returns the metric dimension β(G), an optimal resolving set, and per-vertex distance signatures.
321+
- **Use cases:** Sensor placement for robot localisation, chemical-graph identification, network-fingerprinting research.
322+
323+
### Graph Symmetry & Automorphism Orbits
324+
- **File:** `GraphSymmetryAnalyzer.java`
325+
- **Complexity:** O(k · (V + E)) per Weisfeiler–Leman iteration; exponential worst-case for the exact automorphism group
326+
- **Algorithm:** Color-refinement (1-WL) produces vertex equivalence classes that are a superset of true orbits; for small graphs these are refined by backtracking automorphism search. Reports orbit sizes, vertex-/edge-transitivity flags, and a symmetry score (fraction of vertices in non-trivial orbits).
327+
- **Use cases:** Structural equivalence detection, canonical labelling, anomaly detection (vertices in singleton orbits often play unique roles).
328+
329+
### Graph Drawing Quality
330+
- **File:** `GraphDrawingQualityAnalyzer.java`
331+
- **Complexity:** O(E²) for edge-crossing count; O(V + E) for the remaining metrics
332+
- **Algorithm:** Evaluates the aesthetic quality of a 2-D layout using standard graph-drawing metrics: edge-crossing count, edge-length uniformity (coefficient of variation), minimum angular resolution at vertices, node-overlap ratio, and stress (Σ (d_euc − d_graph)² weighted by 1/d_graph²). Produces a composite readability score.
333+
- **Use cases:** Comparing layout algorithms, automated layout-parameter tuning, regression testing of force-directed implementations.
334+
335+
### Graph Cluster Quality
336+
- **File:** `GraphClusterQualityAnalyzer.java`
337+
- **Complexity:** O(V + E) for modularity, conductance, coverage, performance
338+
- **Algorithm:** Evaluates any vertex partition (from Louvain, GraphPartitioner, or user-supplied) using a battery of partition-quality metrics: Newman–Girvan modularity Q, conductance per cluster and aggregate, coverage (fraction of intra-cluster edges), performance, and normalised cut. Reports per-cluster density and size distribution.
339+
- **Use cases:** Selecting between community-detection algorithms, validating ground-truth communities, sweeping resolution parameters.
340+
261341
### Graph Entropy Analysis
262342
- **File:** `GraphEntropyAnalyzer.java`
263343
- **Complexity:** O(V² + E) for full computation (eigenvalue decomposition dominates)
@@ -321,6 +401,12 @@ A comprehensive reference for all graph algorithms implemented in GraphVisual, o
321401
- **Complexity:** O(V × avg_degree²) per metric
322402
- **Algorithm:** Predicts missing edges using four similarity metrics: Common Neighbors, Jaccard Coefficient, Adamic-Adar Index, and Preferential Attachment.
323403

404+
### Node Similarity (Structural)
405+
- **File:** `NodeSimilarityAnalyzer.java`
406+
- **Complexity:** O(V² · avg_degree) for all-pairs; O(V · avg_degree) per query pair
407+
- **Algorithm:** Pairwise structural similarity using Jaccard, Overlap (Szymkiewicz–Simpson), Adamic–Adar, Sørensen–Dice, cosine over neighbour-set indicator vectors, and preferential-attachment scores. Returns ranked top-k similar pairs and per-vertex nearest-neighbour lists.
408+
- **Use cases:** Friend recommendation, role discovery, candidate generation for link prediction, structural deduplication.
409+
324410
### Influence Spread (Independent Cascade)
325411
- **File:** `InfluenceSpreadSimulator.java`
326412
- **Complexity:** O(simulations × (V + E))
@@ -333,6 +419,44 @@ A comprehensive reference for all graph algorithms implemented in GraphVisual, o
333419

334420
---
335421

422+
## Graph Transformation & Construction
423+
424+
### Line Graph L(G)
425+
- **File:** `LineGraphAnalyzer.java`
426+
- **Complexity:** O(V + E · avg_degree) construction; O(E²) worst-case for dense graphs
427+
- **Algorithm:** Builds the line graph L(G), in which every edge of G becomes a vertex of L(G) and two vertices of L(G) are adjacent iff their underlying edges share an endpoint. Provides forward/backward edge-vertex mappings, reports |V(L(G))| = |E(G)| and |E(L(G))| = Σ_v C(deg(v), 2), and exposes line-graph-specific properties (claw-freeness check, triangle count translation, Whitney-isomorphism witnesses where applicable).
428+
- **Use cases:** Reducing edge-centric problems (edge colouring, edge betweenness) to vertex-centric ones, characterisation of line-graph-recognisable structures, theoretical conversions.
429+
430+
### Graph Complement Ḡ
431+
- **File:** `GraphComplementAnalyzer.java`
432+
- **Complexity:** O(V²) construction; complement-vs-original comparison in O(V + E)
433+
- **Algorithm:** Constructs the complement Ḡ, in which an edge exists iff it does *not* exist in G. Provides side-by-side statistics: density, degree sequence, connected-component count, triangle count, and self-complementary detection. Useful as a primitive for clique-cover / coloring duality (θ(G) = χ(Ḡ)) and perfect-graph testing.
434+
- **Use cases:** Anti-edge analysis, sparse↔dense problem conversion, exposing missing-relationship structure in social graphs.
435+
436+
### Graph Minor Operations
437+
- **File:** `GraphMinorAnalyzer.java`
438+
- **Complexity:** O(V + E) per edge contraction, vertex deletion, or edge deletion
439+
- **Algorithm:** Implements the minor-construction primitives: edge contraction (merge endpoints, redirect incident edges, deduplicate, drop self-loops), vertex deletion (with all incident edges), and edge deletion. Supports replay of a recorded minor sequence to derive a minor H ≤ G and verifies subgraph / topological-minor relationships for small witnesses.
440+
- **Use cases:** Treewidth experimentation, Robertson–Seymour-style minor checks, network simplification while preserving connectivity skeletons.
441+
442+
### Graph Sparsification
443+
- **File:** `GraphSparsificationAnalyzer.java`
444+
- **Complexity:** O(V·E) for cached edge-betweenness; O(E log E) for random / spanning-tree variants
445+
- **Algorithm:** Reduces |E| while preserving target structural properties. Strategies: (a) spanning-tree sparsification (minimum edges keeping connectivity), (b) edge-importance scoring via betweenness / bridge detection / redundancy with a cached betweenness pass, and (c) random sparsification toward a target retention ratio. Reports retention statistics, change in connectivity / diameter / clustering, and per-edge importance scores.
446+
- **Use cases:** Speeding up downstream analyses on dense graphs, visual decluttering for large layouts, building benchmark families.
447+
448+
---
449+
450+
## Special Graph Classes
451+
452+
### Tournament Graph Analysis
453+
- **File:** `TournamentAnalyzer.java`
454+
- **Complexity:** O(V²) Hamiltonian-path construction; O(V²) score sequence; O(V³) condensation / king detection
455+
- **Algorithm:** A tournament is a directed graph obtained by orienting every edge of K_n. Implements the constructive O(n²) Hamiltonian-path algorithm (every tournament has one), score-sequence computation with Landau's necessary-and-sufficient condition, king-vertex detection (vertex reaching all others in ≤ 2 hops), strong-connectivity test, and transitive-tournament recognition.
456+
- **Use cases:** Round-robin ranking, paired-comparison models, social-choice analysis, tournament-sport scheduling.
457+
458+
---
459+
336460
## Export & Generation
337461

338462
### GraphML Export
@@ -356,9 +480,13 @@ A comprehensive reference for all graph algorithms implemented in GraphVisual, o
356480
| Community | Louvain, K-Core, Motifs, Cliques | O(V + E) | Cliques O(3^(V/3)) |
357481
| Connectivity | Tarjan, Kosaraju, Resilience, κ/λ | O(V + E) | Resilience O(V·(V+E)) |
358482
| Matching | Hopcroft-Karp, Vertex Cover | O(E√V) | Independent Set (NP-hard) |
359-
| Coloring | DSatur, Chordal | O(V² + E) | General coloring (NP-hard) |
483+
| Coloring | DSatur, Chordal, Perfect-Graph | O(V² + E) | Odd-hole search O(V⁵) |
360484
| Flow | Edmonds-Karp, Kruskal, MaxCut, Partitioning | O(E log E) | MaxCut (NP-hard) |
361-
| Layout | Fruchterman-Reingold | O(iter·(V²+E)) | |
362-
| Structural | Diameter, Spectral, Treewidth, Struct. Holes, Entropy | O(V + E) | Entropy O(V²) eigenvalue |
485+
| Layout | Fruchterman-Reingold, Drawing-Quality | O(iter·(V²+E)) | Edge-crossing count O(E²) |
486+
| Structural | Diameter, Spectral, Treewidth, Struct. Holes, Entropy, Regularity, Neighborhood, Symmetry, Small-World | O(V + E) | Metric Dimension (NP-hard) |
363487
| Comparison | Diff, Similarity, Persistence, Growth | O(V + E) | Similarity O(V²) eigenvalue |
364488
| Temporal | TemporalGraph, Persistence, Growth | O(W × E) ||
489+
| Transformation | Line Graph, Complement, Minor, Sparsification | O(V + E) per op | Edge betweenness O(V·E) |
490+
| Special Classes | Tournament, Bipartite, Perfect, Chordal, Tree, Regular | O(V + E) recognition | Perfect odd-hole O(V⁵) |
491+
| Cohesion | K-Truss, Rich-Club, K-Core, Cliques | O(m·t_max) | Cliques O(3^(V/3)) |
492+
| Similarity | Node Similarity, Link Prediction | O(V·avg_deg²) | All-pairs O(V²·avg_deg) |

0 commit comments

Comments
 (0)