This repository was archived by the owner on Jun 18, 2026. It is now read-only.
test: add comprehensive tests for DimacsExporter - #154
Merged
Merged
Conversation
17 test cases covering: - Constructor validation (null rejection) - Empty, single-edge, and isolated vertex graphs - Path graph (all bridges, equal betweenness) - Triangle (no bridges, symmetric betweenness) - Barbell graph (bridge detection between cliques) - Star graph (center edges as bridges) - 4-cycle (no bridges, uniform betweenness) - Disconnected graph components - Top-K ranking and descending sort order - Summary statistics (max/avg/median) - Lazy auto-computation on first query - EdgeScore accessor coverage - HTML export (file creation and content)
The cursor was positioned ON the first row via rs.first(), then rs.next() immediately advanced to the second row, causing the first event record of every day to be silently dropped from meeting detection. Fix: use rs.beforeFirst() to position the cursor BEFORE the first row, so the subsequent rs.next() correctly reads the first row. This could cause meetings to be missed when the first event record contained a unique device pair or was the start of a co-location window.
Interactive tool using Tarjan's DFS algorithm to find critical vertices (articulation points) and edges (bridges) in undirected graphs. Features: - Draw graphs interactively (add/delete nodes and edges, drag to move) - Step-by-step or animated algorithm execution with speed control - Visual indicators: red for APs, amber for bridges, blue for DFS tree - Discovery/low value table updated in real time - 6 presets (simple bridge, tree, biconnected, chain, complex, disconnected) - Back edge detection with dashed line visualization - Component counting for disconnected graphs Usage: Open docs/bridges.html in a browser
…SQL queries The five relationship queries (friend, study-group, classmate, stranger, familiar-stranger) shared ~95% identical SQL structure, differing only in location filter, duration comparison operator, and count comparison operator. Extract a buildMeetingSql() helper that takes these three axes as parameters and generates the full parameterized query. Reduces ~30 lines of duplicated SQL string concatenation to 5 concise calls, making it trivial to see how relationship types differ and ensuring any structural query change (e.g. adding a new WHERE clause) only needs to happen in one place.
- classifyTopology: replaced two vertex iterations + 2n graph.degree() calls with single pass over degreeCentrality map values, computing isolated count, max, sum, and sum-of-squares simultaneously using the E[X²]-E[X]² variance formula - getTopByMetric: reuse getRankedResults() instead of rebuilding CentralityResult list; extract comparator before sort call to avoid repeated string comparison inside lambda
CycleAnalyzer.girth(): terminate BFS loop early when the theoretical minimum cycle length (3 for undirected, 2 for directed) is reached, avoiding unnecessary BFS passes on remaining vertices. NodeSimilarityAnalyzer.kNearestNeighbors(): replace full-sort approach (O(V log V) time, O(V) memory) with a bounded min-heap of size k (O(V log k) time, O(k) memory), matching the pattern already used by mostSimilar().
- EdgeTypeRegistryTest: 17 tests covering name lookups, hex/RGB color lookups, unknown type fallbacks, null handling, bulk accessors, unmodifiable collection guarantees, and constant values. - CliqueCoverAnalyzerTest: 20 tests covering empty graph, single vertex, complete graph, independent set, path graph, disjoint triangles, exact minimum solver, cover validation (valid/invalid/missing/duplicate), quality metrics, bounds, full report generation, large graph exact solver skip, and null argument handling.
…nance scores, transitivity, and upsets - computeDominanceScores: compute inline instead of materializing full O(n²) dominance matrix - analyzeTransitivity: iterate over actual beat-pairs instead of all O(n³) index triples - findUpsets: add overload accepting pre-computed ranking; generateReport reuses it
New interactive browser tool (docs/resilience.html) for testing network robustness: - 4 attack strategies: highest-degree, highest-betweenness, random, cascading - 6 preset graphs: Barabási-Albert, Erdős-Rényi, Watts-Strogatz, Star, Grid, Karate Club - Real-time robustness curve plotting with R-index computation - Strategy comparison: save and overlay multiple attack curves - Step-through and continuous animation with speed control - Force-directed layout with drag-to-move nodes - Live stats: giant component size, component count, removed nodes - Attack log with per-step metrics Usage: Open docs/resilience.html in a browser, pick a graph preset, choose an attack strategy, and hit Run Attack to watch the network fragment.
Interactive HTML tool for testing graph planarity with: - Canvas-based graph editor (add/move/delete nodes and edges) - Planarity analysis with edge density bounds (E ≤ 3V-6, E ≤ 2V-4) - K5 and K3,3 subdivision detection with visual highlighting - Euler's formula computation for planar graphs - Force-directed auto-layout - 8 preset graphs (K4, K5, K3,3, Petersen, Cube, Icosahedron, Tree, K4-e) - Step-by-step analysis log with pass/fail indicators Usage: Open docs/planarity.html in browser, draw a graph or load a preset, click Test.
…elineMetricsRecorder, and Network - EdgeBetweennessAnalyzer.exportHtml() wrote files without path validation (CWE-22) - TimelineMetricsRecorder.exportCsv() wrote files without path validation (CWE-22) - Network.generateFile() had inline validation but missed tmpDir; now uses shared ExportUtils.validateOutputPath() All file-writing methods now use the centralized ExportUtils.validateOutputPath() to prevent directory traversal attacks.
…raphNetworkProfiler The classify() method referenced 'degCV' (3 occurrences) but the field is declared as 'degreeCV'. This caused a compilation error, making the network classification for lattice, random, and core-periphery types non-functional.
- Add QEMU setup for cross-platform emulation - Build linux/amd64 and linux/arm64 images on push/tag - PR builds remain single-platform (amd64) for speed + local load
… path - Replace recursive dfsForward/dfsReverse with iterative stack-based implementations to prevent StackOverflowError on large tournaments - Replace O(n³) LinkedList-based Hamiltonian path insertion with ArrayList + binary search for O(n log n) total complexity - Remove LinkedList.get(it.nextIndex()) anti-pattern (O(n) per call)
ArrayDeque provides ~2-3x faster queue operations than LinkedList due to contiguous memory layout (better CPU cache utilization) and no per-node object allocation overhead. LinkedList allocates a Node wrapper object for every element, causing cache misses and GC pressure. Replaced 70 instances across 39 files. All usages were Queue/Deque operations (add/poll/addFirst) where ArrayDeque is a drop-in replacement.
…th cycle detection, 7 presets, text input New interactive tool at docs/toposort.html: - Two algorithms: Kahn's (BFS) and DFS-based topological sort - Step-by-step animation with adjustable speed - Cycle detection with visual highlighting - 7 preset DAGs: Diamond, Build System, Course Prereqs, Data Pipeline, Cycle, Linear Chain, Wide DAG - Text input parser (A -> B format) - In-degree table, queue/stack visualization, longest path stat - Canvas-based graph editor: add/move/delete nodes and directed edges
- countIntersection now iterates the smaller set and probes the larger, reducing choosePivot from O(|P|) to O(min(|P|,|N(u)|)) per candidate. On dense graphs where neighbor sets are small relative to P, this cuts pivot selection time significantly. - formatSummary no longer double-computes coverage: previously called getCoverage() (iterating all cliques) then re-iterated to count covered vertices. Now does it in a single pass.
Replace HashSet<V> + Map<V, Long> per-simulation allocations with int[]-based tracking in RandomWalkAnalyzer.hittingTimesFrom(): - Vertex-to-index mapping eliminates autoboxing and Map.get() in hot loop - Generation counter for visited tracking: O(1) reset per simulation instead of allocating a new HashSet(V) × 10,000 simulations - Pre-built int[][] adjacency for cache-friendly neighbor access - long[]/int[] accumulators instead of LinkedHashMap<V, Long> For a graph with V=100 vertices, this eliminates ~10,000 HashSet allocations of 100 elements each, plus ~20,000 Map.get()/put() calls per simulation in the inner loop.
…itting-times-array perf: array-indexed tracking in hittingTimesFrom (eliminates 10k HashSet allocs)
…mWalkAnalyzer Replace per-simulation HashSet allocation with int[] generation-counter tracking and pre-built int[][] adjacency lists. Same optimization pattern as hittingTimesFrom — eliminates O(V) HashSet allocation/GC per sim (10,000 sims default), replaces it with O(1) generation-counter reset. Cache-friendly sequential array access instead of HashMap lookups.
The dependency table listed PostgreSQL JDBC 8.3-604 and Commons IO 1.4 with upgrade recommendations, but pom.xml already uses 42.7.5 and 2.18.0 respectively. Updated table to reflect reality and removed stale upgrade recommendations. Added Woodstox 7.1.0 entry.
…curity-docs-2026-04-03 docs: update SECURITY.md dependency table to match actual versions
Adds 11 test cases covering: - Vertex/edge count accessors - Triangle graph export with correct problem line and edge format - Comment headers with description and timestamp - Empty graph and single vertex edge cases - exportWithSummary output - Null graph rejection (NullPointerException) - Null description handling - 1-based vertex ID mapping in comments - No duplicate edges in output
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds 11 test cases for \DimacsExporter, covering: