Skip to content

Add structured optimization-target diagnostics for centrality, null models, and uncertainty workflows#1312

Closed
Copilot wants to merge 3 commits intomasterfrom
copilot/cent-perf-optimization-targets
Closed

Add structured optimization-target diagnostics for centrality, null models, and uncertainty workflows#1312
Copilot wants to merge 3 commits intomasterfrom
copilot/cent-perf-optimization-targets

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 28, 2026

This PR addresses the request to identify likely performance bottlenecks in centrality, null-model, and uncertainty paths, and expose concrete optimization targets in code (without adding new markdown docs).
It adds a programmatic diagnostics surface that returns scan-friendly, machine-readable bottleneck recommendations tied to specific functions and code locations.

  • New diagnostics API for performance targeting

    • Added py3plex/diagnostics/optimization_targets.py with:
      • OptimizationArea (centrality, null_models, uncertainty)
      • OptimizationTarget (function/file/line range, bottleneck, complexity, optimization target, expected gain, impact)
      • OptimizationTargetReport (targets + network context + optional profiling)
      • find_optimization_targets(...) entrypoint for filtered, structured reports
  • Concrete hotspot catalog (high-signal, code-addressable)

    • Encodes likely bottlenecks and optimization targets for:
      • centrality robustness recomputation / graph reconstruction loops
      • null-model multiprocessing serialization and per-edge rebuild overhead
      • uncertainty co-association / VI/NMI nested-loop paths and serial sampling loops
    • Each target includes precise function path and line range to support direct follow-up optimization work.
  • Runtime context integration

    • Report includes lightweight network-size context (nodes, edges, layers).
    • Optional integration with global PerformanceMonitor to attach observed timing stats for matching hotspot functions.
  • Public package export

    • Exposed new API from py3plex.diagnostics (find_optimization_targets, OptimizationArea, OptimizationTarget, OptimizationTargetReport) for direct use by tooling and downstream workflows.
  • Focused coverage for new behavior

    • Added tests/test_diagnostics_optimization_targets.py to validate:
      • area coverage and filtering
      • network stats extraction
      • profiling attachment shape
      • report serialization contract
from py3plex.diagnostics import find_optimization_targets, OptimizationArea

report = find_optimization_targets(
    network=net,
    areas=[OptimizationArea.CENTRALITY, OptimizationArea.UNCERTAINTY],
    include_profiling=True,
)

for t in report.targets:
    print(t.function, t.line_range, "->", t.optimization_target)

payload = report.to_dict()  # machine-readable for CLI/UI/automation

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI linked an issue Mar 28, 2026 that may be closed by this pull request
Copilot AI and others added 2 commits March 28, 2026 07:36
Copilot AI changed the title [WIP] Identify and suggest optimization targets for cent perf Add structured optimization-target diagnostics for centrality, null models, and uncertainty workflows Mar 28, 2026
Copilot AI requested a review from SkBlaz March 28, 2026 07:38
@SkBlaz SkBlaz closed this Mar 29, 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.

cent perf

2 participants