Skip to content

Releases: IEE-TUGraz/NPAP

1.0.2

10 Apr 11:15
022d5ee

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: 1.0.1...1.0.2

1.0.1

16 Feb 09:26

Choose a tag to compare

New Features

  • Per-type edge aggregation: Aggregate edge properties independently by edge type (e.g., line, trafo, link), returning a
    MultiDiGraph with one edge per type per cluster pair. Supports per-type strategy configuration with fallback to default edge
    strategies.

Edge Case Fixes

  • AverageNodeStrategy: Warns and falls back to first available value for non-numeric properties instead of silently returning
    0.0
  • EquivalentReactanceStrategy: Warns when returning inf due to non-numeric values; raises AggregationError when the property
    is entirely missing
  • VA partitioning strategies: Reject single voltage level graphs with a clear ValidationError instead of proceeding silently

Maintenance

  • Pre-commit hooks updated
  • GitHub Actions dependencies bumped

Full Changelog: 1.0.0...1.0.1

Production-Ready Release

09 Feb 11:15

Choose a tag to compare

πŸš€ NPAP v1.0.0 β€” Production-Ready Release

The first production-ready release of NPAP (Network Partitioning & Aggregation Package). Since the initial v0.1.0, the library has undergone a massive expansion β€” 98 commits, 80 files changed, ~19,000 lines added β€” covering new strategies, comprehensive testing, full documentation, performance optimizations, and CI/CD infrastructure.

πŸ“– Full documentation: npap.readthedocs.io


✨ What's New since v0.1.0

⚑ New Features

  • Electrical Distance Partitioning β€” New partitioning strategy based on PTDF-derived electrical proximity using the network susceptance matrix. Supports multi-island grids.
  • AC-Island Awareness in Geographical Partitioning β€” Geographical strategies now automatically detect and respect AC island boundaries when voltage-aware data is loaded. Supported by K-Medoids, DBSCAN, HDBSCAN, and Hierarchical (non-ward) clustering.
  • Voltage-Aware Electrical Partitioning β€” New VAElectricalPartitioning strategy that combines AC-island and voltage-level awareness with electrical distance clustering.
  • Spherical-to-Cartesian Coordinate Conversion β€” K-Means geographical partitioning now converts spherical (lat/lon) coordinates to Cartesian space to avoid distorted clusters at high latitudes.
  • Configurable Visualization β€” New PlotConfig dataclass to override default Plotly map styling (tile layer, zoom, center, colors).
  • Centralized Logging β€” Structured logging across all modules (input, partitioning, aggregation, managers) for better debugging and traceability.
  • Input Validation β€” Partition methods now validate that required node/edge attributes exist before execution, with clear error messages.

🏎️ Performance

  • Vectorized Data Loading β€” Data loaders and topology checks optimized with NumPy/Pandas vectorized operations.
  • Vectorized Partitioning β€” Partitioning strategies refactored to use NumPy array operations instead of Python loops.
  • Faster Aggregation β€” Graph aggregation pipeline optimized for reduced overhead.

πŸ› Bug Fixes

  • Fixed electrical partitioning for multi-island grids β€” PTDF computation now correctly handles disconnected AC islands instead of failing on singular matrices.

πŸ“– Documentation

  • Full Sphinx documentation hosted on ReadTheDocs (npap.readthedocs.io) with pydata-sphinx-theme.
  • User Guide β€” Installation, quick start, data loading, partitioning (geographical, electrical, VA-geographical, VA-electrical), aggregation, visualization, and extending NPAP.
  • API Reference β€” Auto-generated from NumPy-style docstrings for all public classes and functions.
  • Contributing Guide β€” Getting started, development workflow, extending NPAP, pull requests, reporting issues, and code of conduct.
  • Comprehensive docstrings β€” All public API updated to NumPy docstring convention.

πŸ§ͺ Testing

  • Comprehensive test suite with pytest covering:
    • All partitioning strategies (geographical, electrical, VA-geographical, VA-electrical)
    • All input strategies (CSV, NetworkX, voltage-aware loader)
    • All aggregation strategies (topology, property, equivalent reactance)
    • Utility functions
    • AC-island detection and DC-island isolation
  • Coverage reporting via Codecov integration.

πŸ”§ CI/CD & Infrastructure

  • GitHub Actions CI β€” Lint (Ruff + Codespell) and test (Python 3.10, 3.11, 3.12) on every push/PR.
  • PyPI publish workflow β€” Automated publishing via trusted publishing on GitHub Release.
  • Pre-commit hooks β€” Ruff linting/formatting, Codespell, and standard file checks.
  • Dependabot β€” Automated dependency and GitHub Actions updates.
  • Issue templates β€” Structured bug report and feature request forms.
  • Pull request template β€” Standardized PR checklist.

πŸ“¦ Installation

pip install npap

v0.1.0

15 Dec 11:54

Choose a tag to compare

Initial Release: Network Partitioning & Aggregation Package (NPAP)

This is the initial release of NPAP, a Python library designed for the partitioning and aggregation of spatial network data, with a specific focus on electrical power systems.

Module Breakdown

πŸ”Œ Input Module (npap.input)

Handles data ingestion through flexible strategies.

  • Standard Loading: Supports loading graph data from CSV files or existing NetworkX objects.
  • Voltage-Aware Loader: A specialized strategy (va_loader) for power systems that parses nodes, lines, transformers, and DC links. It automatically detects DC islands and validates network connectivity before processing.

🧩 Partitioning Module (npap.partitioning)

Implements clustering algorithms to group network nodes based on physical or spatial metrics.

  • Geographical: Clusters nodes based on spatial coordinates using K-Means, K-Medoids, DBSCAN, or Hierarchical clustering.
  • Electrical: Groups nodes based on electrical distance derived from the network's susceptance matrix (PTDF approach).
  • Voltage-Aware Geographical: A specialized strategy that strictly respects DC island boundaries and voltage levels during geographical clustering. Available in "Standard" and "Proportional" modes.

πŸ“¦ Aggregation Module (npap.aggregation)

Manages the reduction of graph topology and nodes/edges attributes through a configurable pipeline.

  • Strategies: Includes custom Topology Strategies (Simple, Electrical) and Property Strategies (Sum, Average, First).
  • Power System Specifics: Features an EquivalentReactance strategy to correctly calculate the parallel impedance 1/sum(1/x) of aggregated lines.

πŸ“Š Visualization Module (npap.visualization)

Provides high-performance, interactive network visualization using Plotly.

  • Simple Style: Uniform styling for quick structural overviews.
  • Voltage-Aware Style: Edges colored by edge type (Line, Transformer, DC Link) and voltage level.
  • Clustered Style: Nodes colored by their assigned partition cluster for easy visual validation.

βš™οΈ Core Managers (npap.managers)

Contains the PartitionAggregatorManager, the central orchestrator of the library. It provides a unified API to load data, execute partitioning strategies, and perform aggregation workflows in a single seamless process.

Installation

pip install npap