A fast implementation of the Goemans-Williamson scheme for the prize-collecting Steiner tree / forest problem.
Project description
#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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pcstf-1.0.10.post1.tar.gz
.
File metadata
- Download URL: pcstf-1.0.10.post1.tar.gz
- Upload date:
- Size: 537.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 371506e0655950a121e4d6ee80ddf63c714c7c7dcee83eb11dbe3bbacc89a13c |
|
MD5 | 369fbca6bd8a039337ce5a868ecdc002 |
|
BLAKE2b-256 | b1073525136f3848fa0873860b1de58c70d76ae0d92570c1ae4764e840e6fd0a |
File details
Details for the file pcstf-1.0.10.post1-cp311-cp311-macosx_11_0_arm64.whl
.
File metadata
- Download URL: pcstf-1.0.10.post1-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 94.6 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b444da756cc97522f14e222e9fe4a818a70acaa3e034e4a1331646ba3b0f0be7 |
|
MD5 | 9521061e6d51491f1aadd9091435939e |
|
BLAKE2b-256 | 4e14a52332915fa23cb6ddcc30c42b2c23a71e7f8274163ce4afeda0b17badde |