Skip to content

Refactor: Split monolithic source into dedicated files#1

Merged
AJ0070 merged 1 commit into
JuliaGraphs:mainfrom
AJ0070:pr/split-source
Apr 29, 2026
Merged

Refactor: Split monolithic source into dedicated files#1
AJ0070 merged 1 commit into
JuliaGraphs:mainfrom
AJ0070:pr/split-source

Conversation

@AJ0070
Copy link
Copy Markdown
Member

@AJ0070 AJ0070 commented Apr 29, 2026

This PR refactors src/NetworkXGraphs.jl by splitting its monolithic implementation into several dedicated files, improving maintainability and aligning the codebase with established JuliaGraphs conventions (such as IGraphs.jl).

Changes:

  • Extracted PythonNetworkX sub-module into src/python_networkx.jl
  • Moved types and constructors (AbstractNetworkXGraph, NetworkXGraph, NetworkXDiGraph) to src/types.jl
  • Moved all Graphs.jl API implementations to src/graph_api.jl
  • Moved graph conversion helpers (networkx_graph) to src/conversions.jl
  • Simplified src/NetworkXGraphs.jl to serve purely as the package entry-point.

This is a structural refactoring only; there are no behavioral changes to the API.

Move each logical concern into its own file following IGraphs.jl style:
- src/python_networkx.jl  — PythonNetworkX sub-module
- src/types.jl            — AbstractNetworkXGraph, NetworkXGraph, NetworkXDiGraph, constructors
- src/graph_api.jl        — All Graphs.jl interface method implementations
- src/conversions.jl      — networkx_graph() converters

src/NetworkXGraphs.jl is now a lean entry-point with include() calls only.
No behaviour change; all 38 tests pass.
@AJ0070
Copy link
Copy Markdown
Member Author

AJ0070 commented Apr 29, 2026

@Krastanov can I get review on this?

Copy link
Copy Markdown
Member

@Krastanov Krastanov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on a skim, it looks good. I doubt there will be the bandwidth for a proper review, so let's not have this die out on the fine and proceed with merging

Could you look into expanding the testing infrastructure next, to make trust in PRs a bit higher. Get Aqua and JET, maybe a formatter, ImplicitImport checks, and CI on more platforms and on nightly. Check Graphs.jl for how it is done there.

Feel free to merge approved PRs yourself.

@Krastanov
Copy link
Copy Markdown
Member

(oh, and code coverage too, TagBot, dependabot, downgrade checks, etc)

@AJ0070
Copy link
Copy Markdown
Member Author

AJ0070 commented Apr 29, 2026

Sure, I'll do that in my next PR. Thanks!

@AJ0070 AJ0070 merged commit ea5e9b7 into JuliaGraphs:main Apr 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants