Skip to content

Parallelization of Degree Centrality #98

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

SKADE2303
Copy link

@SKADE2303 SKADE2303 commented Mar 24, 2025

1. Degree Centrality Implementation

Distributes degree centrality computation across multiple workers:

  • Function Signature: Maintains NetworkX compatibility with added parallelization parameter
  • Normalization: Correctly implements degree normalization by dividing by (n-1)
  • Special Cases: Handles single-node graphs and empty graphs appropriately
  • Technical Details
  • Directed Graphs: Computes in-degree centrality (matching NetworkX behavior)
  • Multigraphs: Correctly handles parallel edges during degree calculation
  • Worker Distribution: Balances node processing across available workers

2. Testing Framework

Tests verify correctness and performance across multiple graph configurations:

  • Graph Types: Tests directed, undirected, weighted, and multigraphs
  • Size Variations: From empty graphs to large networks (1000+ nodes)
  • Topology Tests: Path graphs, random graphs, disconnected components
  • Special Case Tests: Self-loops, isolated nodes, single-node graphs
  • Chunking Tests: Both default and custom chunking strategies

Future Improvements

Another idea would be to add an approximate version that samples paths instead of calculating every single shortest path - would be way faster for those huge graphs I was testing with. I'm also thinking it'd be really handy to implement an incremental update feature, so you don't waste time recalculating everything when your graph only changes slightly.

Copy link
Member

@Schefflera-Arboricola Schefflera-Arboricola left a comment

Choose a reason for hiding this comment

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

clossness_centrality is already implemented in PR #72 . Please don't duplicate the effort. Also, could you please clean up this PR and remove the changes outside the scope of this PR(i.e. parallel implementation of degree_centrality)? Please mark the PR "Ready for review" once it's ready.

@Schefflera-Arboricola Schefflera-Arboricola marked this pull request as draft March 25, 2025 19:23
@SKADE2303
Copy link
Author

Thanks for the clarification, @Schefflera-Arboricola. I apologize for the oversight. I wasn’t aware that closeness_centrality was already implemented in PR #72, so I’ll go ahead and remove those changes to avoid any duplication. I’ll also clean up this PR to ensure it strictly focuses on the parallel implementation of degree_centrality and make sure the tests reflect that. Once everything is updated, I’ll mark the PR as "Ready for review." Appreciate the clarification!

@SKADE2303 SKADE2303 force-pushed the issue-82-centrality branch from c60ff28 to 72caca4 Compare March 25, 2025 20:03
@SKADE2303 SKADE2303 marked this pull request as ready for review March 25, 2025 22:51
@SKADE2303 SKADE2303 changed the title Parallelization of Degree Centrality and Closeness Centrality Parallelization of Degree Centrality Mar 27, 2025
@Schefflera-Arboricola Schefflera-Arboricola added the type: Enhancement New feature or request label Apr 3, 2025
@akshitasure12
Copy link
Contributor

Hey @SKADE2303, is this PR being worked on currently? Let me know, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: Enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants