UltipaDocs
Products
Solutions
Resources
Company
Start Free Trial
UltipaDocs
Start Free Trial
  • Introduction
  • Running Algorithms
    • Degree Centrality
    • Closeness Centrality
    • Harmonic Centrality
    • Eccentricity Centrality
    • Betweenness Centrality
    • Bridges
    • Articulation Points
    • Eigenvector Centrality
    • Katz Centrality
    • CELF
    • PageRank
    • ArticleRank
    • TextRank
    • HITS
    • SybilRank
    • Jaccard Similarity
    • Overlap Similarity
    • Cosine Similarity
    • Pearson Correlation Coefficient
    • Euclidean Distance
    • KNN
    • Vector Similarity
    • Bipartite Graph
    • HyperANF
    • Weakly Connected Components (WCC)
    • Strongly Connected Components (SCC)
    • k-Edge Connected Components
    • Local Clustering Coefficient
    • Triangle Count
    • Clique Count
    • k-Core
    • k-Truss
    • p-Cohesion
    • Induced Subgraph
    • Topological Sort
    • Breadth-First Search (BFS)
    • Depth-First Search (DFS)
    • Dijkstra's Shortest Path
    • A* Shortest Path
    • Yen's K-Shortest Paths
    • Shortest Path (BFS)
    • Delta-Stepping SSSP
    • Shortest Path Faster Algorithm (SPFA)
    • All-Pairs Shortest Path (APSP)
    • Minimum Spanning Tree (MST)
    • K-Spanning Tree
    • Steiner Tree
    • Prize-Collecting Steiner Tree (PCST)
    • Minimum Cost Flow
    • Maximum Flow
    • K-Hop Fast
    • Longest Path (DAG)
    • Random Walk
    • Adamic-Adar Index
    • Common Neighbors
    • Preferential Attachment
    • Resource Allocation
    • Total Neighbors
    • Same Community
    • Louvain
    • Leiden
    • Modularity Optimization
    • Label Propagation
    • HANP
    • SLPA
    • k-Means
    • HDBSCAN
    • K-1 Coloring
    • Modularity
    • Conductance
    • Max k-Cut
      • Node2Vec
      • Struc2Vec
      • LINE
      • Fast Random Projection
      • Summary of Graph Embedding
      • Gradient Descent
      • Backpropagation
      • Skip-gram
      • Skip-gram Optimization
  1. Docs
  2. /
  3. Graph Algorithms
  4. /
  5. Pathfinding

Prize-Collecting Steiner Tree (PCST)

Overview

The Prize-Collecting Steiner Tree (PCST) algorithm finds a subtree that balances two competing goals: collecting node prizes and minimizing edge costs. Unlike the standard Steiner tree which must connect all specified terminals, PCST decides which nodes are worth including based on the trade-off between their prize value and the cost of reaching them.

Applications:

  • Network design: Deciding which customers to connect when wiring is expensive.
  • Feature selection: Selecting a connected subgraph of high-value nodes in biological networks.
  • Revenue optimization: Balancing service coverage cost against customer value.

Concepts

Prize-Collecting Steiner Tree

Each node has a prize (value gained by including it) and each edge has a cost (price paid to use it). The algorithm finds a connected subtree that maximizes total prize - λ × total cost.

The λ parameter controls the trade-off:

  • High lambda: Penalizes edge costs more → smaller tree, only high-prize nodes included.
  • Low lambda: Penalizes costs less → larger tree, more nodes included.

The algorithm works by:

  1. Build a minimum spanning tree of the graph, connecting all nodes.
  2. Examine each leaf node (node with only one edge in the tree). If the leaf's prize is less than λ × edge cost, remove it — the cost of reaching it outweighs its value.
  3. Repeat step 2 — removing a node may create new leaf nodes that can also be pruned.
  4. Stop when every remaining leaf node is worth keeping (prize ≥ λ × edge cost).

Considerations

  • The algorithm treats all edges as undirected.

Example Graph

GQL
INSERT (A:default {_id: "A", prize: 10}), (B:default {_id: "B", prize: 5}),
       (C:default {_id: "C", prize: 8}), (D:default {_id: "D", prize: 3}),
       (E:default {_id: "E", prize: 12}), (F:default {_id: "F", prize: 6}),
       (G:default {_id: "G", prize: 4}), (H:default {_id: "H", prize: 2}),
       (A)-[:default {distance: 1}]->(B), (A)-[:default {distance: 2.4}]->(C),
       (A)-[:default {distance: 1.2}]->(D), (A)-[:default {distance: 0.7}]->(E),
       (A)-[:default {distance: 2.2}]->(F), (A)-[:default {distance: 1.6}]->(G),
       (A)-[:default {distance: 0.4}]->(H), (B)-[:default {distance: 1.3}]->(C),
       (C)-[:default {distance: 1}]->(D), (D)-[:default {distance: 1.65}]->(H),
       (E)-[:default {distance: 1.27}]->(F), (E)-[:default {distance: 0.9}]->(G),
       (F)-[:default {distance: 0.45}]->(G)

Parameters

NameTypeDefaultDescription
prizePropertySTRING/Node property to use as prize value. If unset, all nodes have zero prize.
weightPropertySTRING/Edge property to use as cost. If unset, all edges have unit cost.
lambdaFLOAT1.0Trade-off parameter. Higher values penalize edge costs more, producing smaller trees.

Run Mode

Returns:

ColumnTypeDescription
nodeIdSTRINGNode identifier (_id)
inTreeBOOLWhether the node is included in the tree
totalCostFLOATTotal edge cost of the tree
totalPrizeFLOATTotal prize of nodes in the tree
GQL
CALL algo.pcst({
  prizeProperty: "prize",
  weightProperty: "distance",
  lambda: 1
}) YIELD nodeId, inTree, totalCost, totalPrize

Stream Mode

Returns the same columns as run mode, streamed for memory efficiency.

GQL
CALL algo.pcst.stream({
  prizeProperty: "prize",
  weightProperty: "distance",
  lambda: 1
}) YIELD nodeId, inTree
FILTER inTree = true
RETURN nodeId

Stats Mode

Returns:

ColumnTypeDescription
nodeCountINTTotal number of nodes in the graph
nodesInTreeINTNumber of nodes included in the tree
totalCostFLOATTotal edge cost of the tree
totalPrizeFLOATTotal prize of nodes in the tree
GQL
CALL algo.pcst.stats({
  prizeProperty: "prize",
  weightProperty: "distance",
  lambda: 1
}) YIELD nodeCount, nodesInTree, totalCost, totalPrize