Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Expand notebook demos with modern py3plex features#936

Merged
SkBlaz merged 5 commits intomasterSkBlaz/py3plex:masterfrom
copilot/review-expand-notebook-demosSkBlaz/py3plex:copilot/review-expand-notebook-demosCopy head branch name to clipboard
Dec 23, 2025
Merged

Expand notebook demos with modern py3plex features#936
SkBlaz merged 5 commits intomasterSkBlaz/py3plex:masterfrom
copilot/review-expand-notebook-demosSkBlaz/py3plex:copilot/review-expand-notebook-demosCopy head branch name to clipboard

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 23, 2025

The existing notebooks covered basic functionality but lacked demonstrations of key ergonomic features added in v1.0: built-in datasets, dplyr-style operations, pipelines, uncertainty quantification, and the plugin system.

Changes

tutorial_10min.ipynb - Added 4 sections:

  • Built-in datasets: load_aarhus_cs(), make_random_multilayer(), list_datasets()
  • Dplyr-style graph ops: nodes().filter().mutate().group_by().summarise()
  • Centrality uncertainty: Multiple centrality metrics (degree, betweenness, closeness, eigenvector) with bootstrap CI, stability analysis with Coefficient of Variation
  • Pipeline API: Pipeline([ComputeStats(), FilterNodes(), LouvainCommunity()])

query_with_dsl.ipynb - Added 4 sections:

  • Layer grouping: per_layer(), top_k(), group_summary()
  • Enhanced uncertainty quantification: .uq(method="bootstrap", n_samples=50, ci=0.95) for multiple centrality metrics
  • Uncertainty visualization: 4-panel plot showing error bars, CI widths, and CV comparison across centralities
  • Temporal queries: .window(start=1.0, end=3.0)

simulate_dynamics.ipynb - Added 3 sections:

  • DynamicsBuilder: D.process(SIR(...)).initial(...).steps(...).run()
  • SimulationResult analysis: measure extraction, peak detection, attack rate
  • Stochastic uncertainty: multiple runs with mean/std confidence bands

community_detection.ipynb - Added 3 sections:

  • Null model testing: configuration_model() for significance
  • Bootstrap uncertainty: CI for modularity and community count
  • Plugin system: CommunityPlugin base class with PluginRegistry

Example: Centrality with Uncertainty

# Compute multiple centralities with uncertainty quantification
result = (
    Q.nodes()
     .from_layers(L["*"])
     .uq(method="bootstrap", n_samples=50, ci=0.95)
     .compute(
         "degree",
         "betweenness_centrality",
         "closeness_centrality",
         "eigenvector_centrality"
     )
     .order_by("-betweenness_centrality")
     .execute(network)
)

# Get results with uncertainty columns (_std, _ci95_low, _ci95_high)
df = result.to_pandas(expand_uncertainty=True)

# Analyze stability with Coefficient of Variation
df['betweenness_cv'] = df['betweenness_centrality_std'] / df['betweenness_centrality']
# CV < 0.2 indicates stable centrality ranking

Example: Dplyr-style Operations

# Before: Manual filtering and computation
nodes = network.get_nodes()
high_degree = [n for n in nodes if network.degree(n) > 2]

# After: Dplyr-style chainable operations with grouping
df = (
    nodes(network)
    .filter(lambda n: n["degree"] > 2)
    .mutate(importance=lambda n: n["degree"] / n["betweenness_centrality"])
    .group_by("layer")
    .summarise(avg_importance=("importance", np.mean))
    .to_pandas()
)

All notebooks retain valid JSON structure. Enhanced with detailed inline comments explaining bootstrap resampling, null models, fluent APIs, and centrality stability assessment.

Original prompt

This section details on the original issue you should resolve

<issue_title>notebook demos</issue_title>
<issue_description>in notebooks there are demos. review, expand with new functionality. Make it more ergonomic. no new md allowed</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits December 23, 2025 15:47
Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
Copilot AI changed the title [WIP] Expand notebook demos with new functionality Expand notebook demos with modern py3plex features Dec 23, 2025
Copilot AI requested a review from SkBlaz December 23, 2025 15:54
@SkBlaz
Copy link
Copy Markdown
Owner

SkBlaz commented Dec 23, 2025

@copilot add examples related to metric uncertainty too (uncertainty of all centralities, for example)

Co-authored-by: SkBlaz <10035780+SkBlaz@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 23, 2025

@copilot add examples related to metric uncertainty too (uncertainty of all centralities, for example)

Added comprehensive centrality uncertainty examples in commit 81199e9:

tutorial_10min.ipynb:

  • New section "Part 7b: Centrality Metrics with Uncertainty"
  • Shows uncertainty for 4 metrics: degree, betweenness, closeness, eigenvector
  • Includes stability analysis with Coefficient of Variation

query_with_dsl.ipynb:

  • Enhanced UQ section from 1 to 4 centrality metrics
  • Added visualization cell with 4 plots showing error bars, CI widths, and CV comparison
  • Includes interpretation guidelines for centrality stability (CV < 0.2 threshold)

@SkBlaz SkBlaz marked this pull request as ready for review December 23, 2025 19:04
@SkBlaz SkBlaz merged commit 2c30701 into master Dec 23, 2025
31 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.

notebook demos

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.