This repository provides a collection of heuristics and approximation algorithms to solve the Steiner Tree Problem. In this problem, we are given an undirected, weighted graph
Greedily connects the closest uncovered terminal to the current tree using Dijkstra paths.
Based on primal-dual schema. Builds dual variables and merges active sets via tight edges.
Implements Mehlhorn’s approach using Voronoi regions and minimum spanning trees in transformed graphs.
Clusters nodes based on proximity to terminals and connects randomly chosen representatives. May return an infesible solution.
Used primarily for preprocessing in the naive heuristic.
nearest_terminal_clustering: assigns nodes to nearest terminal based on Dijkstra.spectral_clustering: clusters nodes using eigenvectors of the Laplacian.kMeans_clustering,kMedoids_clustering: use embeddings from the Laplacian and cluster via sklearn.
Run on a graph file:
python main.py < graphs/graph1.stpThis will create a results.txt file with the results computed with the implemented algorithms and with the networkx built-in Steiner tree approximation algorithm.
You can replace graph1.stp with another graph from the graphs folder. The input format follows the PACE 2018 Steiner Tree Challenge.