Repository navigation
feat: detect parallel edges in directed and undirected graphs - #78
huxiaoyi-ovo wants to merge 11 commits into
Conversation
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 35 |
| Duplication | 2 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Thank you for your interest in pgraph-python, and for this contribution. Before merging, I'd like to extend the PR in a few ways:
For tests, it would be great to extend your random-graph check so it asserts Also, please:
Thanks again, and let me know if you'd rather I made any of these changes myself. |
|
Hi Peter, Thanks for the detailed review. I've addressed all your requests in the existing PR, with the latest changes in
Both methods share the same private endpoint-key helper, while I've also updated the docstrings, README, The expanded regression tests cover groups of three, insertion order, removal and reinsertion, reversed edges, self-loops, and 500 seeded random graphs checked against an independent pairwise reference. The latest fork CI is fully green across Python 3.9–3.14, mypy, and coverage: https://github.com/huxiaoyi-ovo/pgraph-python/actions/runs/41025089369 The PR is ready for review. Could you approve the upstream CI run when convenient? Thanks again for your helpful feedback! |
Summary
Implements parallel-edge detection and grouping for #75, including the improvements requested in the maintainer review.
Graph.isparallel()detects at least two distinct edges sharing endpoints in O(E) time, returning early on the first duplicate.Graph.parallel_edges()returnslist[tuple[Edge, ...]]. Groups are ordered by their first edge, and edges within each group preserve insertion order.Tests
Regression tests cover empty and simple graphs, three-edge groups, group ordering, edge removal and reinsertion, reversed edges, single and repeated self-loops, and directed/undirected graph construction.
An independent pairwise-reference test checks 500 seeded random graphs and verifies
isparallel() == bool(parallel_edges()).Documentation
Updated the API docstrings, README,
docs/llms_intro.md, and CHANGELOG.Verification
Fork CI: Passed
CI: https://github.com/huxiaoyi-ovo/pgraph-python/actions/runs/41025089369
Upstream GitHub Actions awaits maintainer approval.
AI disclosure: ChatGPT assisted with code analysis, implementation, and regression tests.
Fixes #75.