Skip to content

Rewrite scalefree degree generation with truncated discrete power law#73

Merged
johanos1 merged 2 commits intomainfrom
scalefree_generation
Jan 25, 2026
Merged

Rewrite scalefree degree generation with truncated discrete power law#73
johanos1 merged 2 commits intomainfrom
scalefree_generation

Conversation

@johanos1
Copy link
Collaborator

Replace continuous Pareto sampler with proper discrete power-law sampling:

  • Implement truncated discrete power law P(K=k) ∝ k^(-gamma) on k ∈ {kmin..kmax}
  • Solve for gamma numerically via Brent's method to match target average_degree
  • Sample in-degrees and out-degrees separately (not split from total)
  • Balance sums with vectorized integer-only adjustments (bincount)
  • Validate kmax <= n-1 for simple directed graphs (no self-loops/multi-edges)
  • Replace asserts with explicit ValueError for production safety
  • Add comprehensive unit tests (40 tests for new functions)
  • Update configs to use kmin parameter instead of loc

Replace continuous Pareto sampler with proper discrete power-law sampling:
- Implement truncated discrete power law P(K=k) ∝ k^(-gamma) on k ∈ {kmin..kmax}
- Solve for gamma numerically via Brent's method to match target average_degree
- Sample in-degrees and out-degrees separately (not split from total)
- Balance sums with vectorized integer-only adjustments (bincount)
- Validate kmax <= n-1 for simple directed graphs (no self-loops/multi-edges)
- Replace asserts with explicit ValueError for production safety
- Add comprehensive unit tests (40 tests for new functions)
- Update configs to use kmin parameter instead of loc
@johanos1 johanos1 merged commit c2800d9 into main Jan 25, 2026
1 check passed
@johanos1 johanos1 deleted the scalefree_generation branch January 25, 2026 20:03
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.

1 participant