Skip to content
Computing estimations of graph treewidth
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis.yml Continuous integration: small changes. Dec 9, 2016
FillInPermutationStrategy.h Added Maximum Cardinality Search heuristic. Feb 23, 2016
Graph.h New lower bound methods. Sep 8, 2016
LowerBound.h Lower Bounds Sep 13, 2016
MCSPermutationStrategy.h Added lower bound heuristics. Feb 23, 2016
Makefile New Makefile. Dec 9, 2016
MetaLowerBoundHeuristic.h Lower Bounds Sep 13, 2016
common.h Removed license in source files. Oct 24, 2015

Build Status MIT licensed

This repository contains the source code for evaluation of lower and upper bounds of the treewidth of undirected graphs. It implements a subset of the algorithms described in this paper and this paper.


The Makefile is in the main folder, so simply execute make:

make clean; make

The output binary is treedecomp.


The code needs the Boost C++ library headers, and specifically the Fibonacci heap implementation. It assumes the include files are present in /usr/local/include. If your Boost installation is someplace else, you have to modify the INCLUDE_DIRS directive in Makefile. The binary library does not need to be linked.


The program expects as input a graph in the following format, one edge per line:

node1 <TAB> node2

where node1 and node2 are the endpoints of the edge.

The usage is the following:

./treedecomp --upper|lower <graph_file> [<method> [<partial_degree>]]

The parameters are:

  • upper|lower chooses between upper or lower bounds
  • graph_file is the name of the graph file
  • method is the criteria by which each node is chosen next in the decomposition sequence, and can have the following values: 0 minimum degree (default), 1 minimum fill in, and 2 minimum degree+fill in (only for upper bounds)
  • partial_degree is the maximum degree at which the decomposition will stop; in this case, the output files will contain a partial decomposition -- this is useful for large graphs (only for upper bounds)


The output will be a file with the name ..dec containing the tree decomposition.

The format is the following:


treewidth is a number representing the estimated treewidth, number_nodes is the number of nodes in the tree decomposition of the graph.

<node_list contains number_nodes blocks representing the tree nodes, each in the following format:


node_id is the id of the nodes, num_nodes is the number of graph nodes in the tree node, node_list is a whitespace delimited list of the nodes, parent_id is the id of the parent of the node in the tree, num_children is the number of child nodes in the tree, and child_list is the list of their ids (if any).


This code has been tested with the graph datasets available here



The source code is provided as-is under an MIT License.

You can’t perform that action at this time.