Skip to main content

#pcstf

A library for solving the prize-collecting Steiner forest (PCSF) problem on graphs.

Installation

Option 1: pip

pip install pcstf

Option 2: Manual

The core library has no dependencies besides a basic build system for C++11. Both g++ and clang are currently supported. The Python wrapper requires a functioning Python build system.

Compile the python wrapper with the supplied makefile:

make pcst_fast_py

You can then import the package via import pcst_fast.

Usage

The pcst_fast package contains the following function:

vertices, edges = pcst_fast(edges, prizes, costs, root, num_clusters, pruning, verbosity_level)

The parameters are:

  • edges: a 2D int64 array. Each row (of length 2) specifies an undirected edge in the input graph. The nodes are labeled 0 to n-1, where n is the number of nodes.
  • prizes: the node prizes as a 1D float64 array.
  • costs: the edge costs as a 1D float64 array.
  • root: the root note for rooted PCST. For the unrooted variant, this parameter should be -1.
  • num_clusters: the number of connected components in the output.
  • pruning: a string value indicating the pruning method. Possible values are 'none', 'simple', 'gw', and 'strong' (all literals are case-insensitive). 'none' and 'simple' return intermediate stages of the algorithm and do not have approximation guarantees. They are only intended for development. The standard GW pruning method is 'gw', which is also the default. 'strong' uses "strong pruning", which was introduced in [JMP00]. It has the same theoretical guarantees as GW pruning but better empirical performance in some cases. For the PCSF problem, the output of strong pruning is at least as good as the output of GW pruning.
  • verbosity_level: an integer indicating how much debug output the function should produce.

The output variables are:

  • vertices: the vertices in the solution as a 1D int64 array.
  • edges: the edges in the output as a 1D int64 array. The list contains indices into the list of edges passed into the function.

Metadata

Release files for pcstf 1.0.10.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pcstf 1.0.10.post1
File Size Uploaded
pcstf-1.0.10.post1.tar.gz 537.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pcstf 1.0.10.post1
File Interpreter ABI Platform
pcstf-1.0.10.post1-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details

Total release size: 632.5 kB

Release files / pcstf-1.0.10.post1.tar.gz

Download URL pcstf-1.0.10.post1.tar.gz
Size 537.9 kB
Tags Source
SHA-256 checksum
How to use checksums
371506e0655950a121e4d6ee80ddf63c714c7c7dcee83eb11dbe3bbacc89a13c
BLAKE2b-256 checksum
How to use checksums
b1073525136f3848fa0873860b1de58c70d76ae0d92570c1ae4764e840e6fd0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release files / pcstf-1.0.10.post1-cp311-cp311-macosx_11_0_arm64.whl

Download URL pcstf-1.0.10.post1-cp311-cp311-macosx_11_0_arm64.whl
Size 94.6 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
b444da756cc97522f14e222e9fe4a818a70acaa3e034e4a1331646ba3b0f0be7
BLAKE2b-256 checksum
How to use checksums
4e14a52332915fa23cb6ddcc30c42b2c23a71e7f8274163ce4afeda0b17badde
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.1

Release history Release notifications | RSS feed

This release

1.0.10.post1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page