Skip to content

Rule-Based Graph Reduction #20

@samuelsonric

Description

@samuelsonric

There are some well-known "rules" for reducing a graph prior to using an exact treewidth solver. I implemented the ones in this paper.

julia> using CliqueTrees, TreeWidthSolver

julia> graph = [
           0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0
           0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0
           1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
           1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
           1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0
           0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 0
           0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 0
           0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0
           0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0
           0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 1
           0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0
           0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1
           0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0
           0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0
           1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1
           0 0 0 0 1 1 0 0 0 0 0 1 0 0 0 0 0
           0 0 0 0 0 0 0 0 0 1 0 1 0 0 1 0 0
       ];

julia> @time treewidth(graph; alg=BT()) # solve using TreeWidthSolver.jl
  0.000498 seconds (7.11 k allocations: 543.391 KiB)
3

julia> @time treewidth(graph; alg=RuleReduction(BT())) # reduce graph, then solve using TreeWidthSolver.jl
  0.000059 seconds (200 allocations: 18.375 KiB)
3

I ran both versions on your benchmark suite. The red points are with rules, the blue points are without.

Image

I thought you might find this interesting!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions