Repository navigation
Add multi-level Dijkstra routing index - #414
Merged
Merged
Conversation
Adds Graph.MultiLevelIndex with nested rectangular partitions, sparse boundary overlays and a level-aware bidirectional query search. Supports directed graphs and falls back to plain Dijkstra for blocked nodes and edge filters. Refs #413
Adds a DocC guide that explains how the graph, direct searches, contraction, routing indices, landmark routing and multi-level Dijkstra fit together. Covers mode-specific graphs, constraints, custom costs and tuning parameters, and links the guide from the Graph API, performance notes, README and changelog.
Exercises multi-level routing on the Munich and Paris fixtures and on a cycling-filtered Munich graph. Shares real-world fixture graphs through GraphTestHelper and adds multi-level build/query benchmarks for Allgäu, Munich, Munich directed and Paris to the real-world suite.
Moves the unreleased changes under 3.1.0, refreshes current GISTools dependency examples to 3.1.0 and updates the release audit example. Companion package versions and the historical migration guide are unchanged.
SwiftFormat 0.63.0 counted this file's legacy violations nondeterministically (26 or 27), so merely touching the file could trip the format gate. Fix all pre-existing violations in the helper so the count is stable at zero.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds a reusable multi-level Dijkstra (MLD) routing index to the opt-in Graph API.
graph.multiLevelIndex(levels:baseRows:baseColumns:)builds nested rectangular cell partitions with sparse first-boundary overlays.Graph.MultiLevelIndex.shortestPath(from:to:)answers queries with a level-aware bidirectional search: original edges in the endpoint cells, per-node query-level overlays elsewhere.graph.shortestPathViaMultiLevel(from:to:...)is a one-shot convenience.blockedNodesoredgeFilterfall back to plain Dijkstra.partition(...)and the new index.Closes #413.
Tests
swift test --traits EnableGraphAPI— 3089 tests in 211 suites pass.python3 scripts/check_documentation.py— no diagnostics.swift package diagnose-api-breaking-changes origin/main --products GISTools— no breaking changes.swiftformat --lint— clean on the new files.Benchmark note
Grid fixtures are the worst case for multi-level overlays because every cell-perimeter node is a boundary node. At 1M grid edges the index build takes ~16 s and the query ~0.148 s versus ~0.089 s for plain Dijkstra. Real road networks have much sparser cell boundaries; partition-size tuning is documented as a follow-up lever.