Skip to content

Refactor community detection for unified parallel implementation#169

Closed
Musicaldg wants to merge 1 commit into
easy-graph:pybind11from
Musicaldg:pybind11
Closed

Refactor community detection for unified parallel implementation#169
Musicaldg wants to merge 1 commit into
easy-graph:pybind11from
Musicaldg:pybind11

Conversation

@Musicaldg
Copy link
Copy Markdown
Contributor

Refactor community detection: remove serial modularity, use parallel implementation consistently

Summary:
This PR replaces the legacy serial modularity calculation with a unified parallel approach, improving performance and code maintainability. It also cleans up related logic in local search optimization and adds automatic center selection.

Detailed changes:

modularity.cpp

  1. Removed the function calculate_degrees_and_edges_adj_serial and its associated threshold‑based branch (which conditionally chose serial or parallel execution).
  2. Now always calls the parallel calculation function, ensuring consistent behavior and better resource utilization.

localsearch.cpp

  1. Refined center selection logic to be more efficient and robust.
  2. Added proper handling for empty graphs
  3. Improved neighbor traversal patterns and numerical computation

…llel implementation

- Delete `calculate_degrees_and_edges_adj_serial` function and related threshold logic in modularity.cpp; always invoke parallel calculation function
- Optimize center selection, empty graph handling, neighbor traversal, and numerical computation logic in localsearch.cpp
- Fix several edge cases and add automatic center number selection logic
@Musicaldg Musicaldg closed this Jun 6, 2026
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