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

feat: GraphPathExplorer — k-shortest paths, waypoint routing, bottleneck detection - #77

Merged
sauravbhattacharya001 merged 1 commit into
masterfrom
builder/graph-path-explorer
Mar 14, 2026
Merged

sauravbhattacharya001 merged 1 commit into
masterfrom
builder/graph-path-explorer

Conversation

@sauravbhattacharya001

Copy link
Copy Markdown
Owner

GraphPathExplorer — Advanced Path Finding

Extends GraphVisual with advanced path exploration beyond basic shortest-path:

Features

Capability Description
All simple paths DFS enumeration with maxDepth and maxPaths guards
K shortest paths Yen's algorithm (Dijkstra + edge/node exclusions)
Constrained paths Route through ordered waypoints
Avoidance routing Skip forbidden vertices and/or edges
Path statistics Count, length distribution, weight stats, diversity metric
Vertex participation How many paths pass through each intermediate vertex
Bottleneck detection Vertices appearing in ALL paths between a pair
Text report Summary + top-5 shortest + bottlenecks + bar-chart distribution

API

GraphPathExplorer explorer = new GraphPathExplorer(graph);

// All paths with depth/count limits
List<Path> all = explorer.findAllSimplePaths("A", "Z", 15, 500);

// K shortest paths (Yen's algorithm)
List<Path> top3 = explorer.findKShortestPaths("A", "Z", 3);

// Must visit waypoints in order
Path constrained = explorer.findConstrainedPath("A", "Z", List.of("M", "N"));

// Avoid specific nodes or edges
Path detour = explorer.findPathAvoiding("A", "Z",
    Set.of("blocked"), Set.of(edgeKey("X", "Y")));

// Statistics and bottlenecks
PathStats stats = explorer.computePathStats("A", "Z", 10);
Set<String> cuts = explorer.findBottleneckVertices("A", "Z", 10);

// Full text report
System.out.println(explorer.generateReport("A", "Z"));

Tests

82 tests across 11 test groups — all passing. Covers:

  • Constructor validation, all 7 features, edge key canonicalization
  • 7 test graphs: linear, diamond, 3x3 grid, weighted, disconnected, K4, bottleneck

Size

722 source lines + 484 test lines = 1,206 total

…constraints, and bottleneck detection

New analyzer for advanced path exploration beyond basic shortest-path:

- All simple paths enumeration with configurable maxDepth and maxPaths guards
- K shortest paths via Yen's algorithm (Dijkstra-based with edge/node exclusions)
- Constrained paths through ordered waypoints
- Avoidance routing (skip forbidden vertices and/or edges)
- Path statistics (count, length distribution, weight stats, path diversity)
- Vertex path participation (how many paths pass through each vertex)
- Bottleneck vertex detection (vertices that appear in ALL paths between a pair)
- Text report with bar-chart path length distribution

722 source lines, 484 test lines, 82 tests all passing.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@sauravbhattacharya001
sauravbhattacharya001 merged commit 4af5be1 into master Mar 14, 2026
3 of 7 checks passed
@sauravbhattacharya001
sauravbhattacharya001 deleted the builder/graph-path-explorer branch March 14, 2026 17:58
@github-actions github-actions Bot added visualization Graph visualization and UI size/xl labels Mar 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size/xl visualization Graph visualization and UI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant