Implement native multiplex routing with explicit layer-switching costs#960
Merged
Implement native multiplex routing with explicit layer-switching costs#960
Conversation
Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
…ertions Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement multiplex shortest-path routing with layer-switching costs
Implement native multiplex routing with explicit layer-switching costs
Dec 28, 2025
Owner
|
@copilot missing concrete property tests for invariance + corner-cases (single layer) etc. No new md allowed |
- Add 20 property-based tests using Hypothesis for invariance checking - Test network non-mutation, determinism, layer semantics preservation - Add corner cases: single layer, single edge, isolated nodes, star topology - Test mathematical properties: optimality, bounds, switch counting - Test Pareto optimality: non-dominance and determinism - Add 8 additional unit tests for edge cases not previously covered - All 52 tests passing (32 original + 20 property + 8 corner case) Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
Contributor
Author
Added comprehensive property tests and corner case tests in commit 7a00ec5: Property Tests (20 tests in
Additional Corner Cases (8 tests added to existing file):
All 52 tests passing (32 original + 20 property + 8 corner case). No markdown files added. |
Owner
|
@copilot bump lib version |
- Update version in pyproject.toml: 1.0.3 -> 1.1.0 - Update __version__ and __api_version__ in py3plex/__init__.py - Minor version bump for new multiplex routing feature Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
Contributor
Author
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.
Adds native multiplex shortest-path routing that preserves layer semantics without flattening the network. Routes are computed over an implicit (node, layer) state space with configurable switching costs between layers.
Implementation
Core algorithm (
py3plex/algorithms/routing/multiplex_paths.py):API:
Edge data handling: Fixed MultiGraph edge weight extraction to correctly handle NetworkX's
{edge_key: {attr: value}}structure.Testing
Unit Tests (32 tests in
tests/algorithms/routing/test_multiplex_paths.py):Property Tests (20 tests in
tests/property/test_multiplex_routing_properties.py):Example script with 5 scenarios including multi-modal transportation network.
Total: 52 tests passing (32 unit + 20 property)
Version Update
Library version bumped to 1.1.0 (from 1.0.3) to reflect the new routing feature:
pyproject.tomlpy3plex/__init__.py(__version__and__api_version__)Complexity
Time: O((|V|·|L|) log(|V|·|L|) + |E|) where |V| = nodes, |L| = layers, |E| = edges
State space grows as |V|·|L|, so performance scales with layer count.
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.