the glasgow subgraph solver

22
The Glasgow Subgraph Solver Ciaran McCreesh Patrick Prosser James Trimble

Upload: khangminh22

Post on 29-Jan-2023

1 views

Category:

Documents


0 download

TRANSCRIPT

The Glasgow Subgraph SolverCiaran McCreeshPatrick ProsserJames Trimble

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

Subgraph Isomorphism

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 1 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

Subgraph Isomorphism

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 1 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

Who Else Cares?

Chemistry, biochemistry, and drug design (graphs are moleculefragments or proteins).

Computer vision.

Compilers (instruction generation, code rewriting).

Plagiarism and malware detection.

Livestock epidemiology (contact and trade graphs).

Designing mechanical lock systems.

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 2 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

What Exactly is the Problem?

Non-induced or induced?

Directed edges? Multi-edges? Loops?

Injective? Locally injective? Non-injective?

Labels on vertices? Labels on edges?

Nested graphs?

Wildcards? Partial matching?

Connected?

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 3 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

In Theory. . .

Subgraph finding is hard.1

Subgraph counting is hard.

Approximate subgraph finding is hard.

1For an arbitrary pa�ern.Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 4 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

In Practice. . .

We have good solvers for subgraph problems.

We can solve clique on larger graphs than we can solve all-pairsshortest path.2

2Terms and conditions apply.Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 5 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

The Glasgow Subgraph Solver

/ciaranm/glasgow-subgraph-solver

MIT licence.

A constraint programming solver, but specifically for subgraphproblems.

Subgraph isomorphism and its many variants (induced /non-induced, homomorphism, locally injective, labels, sideconstraints, directed, . . . ), maximum common subgraph, andclique.

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 6 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

Key Features

Really good performance on “hard” instances, e.g. large pa�erngraphs.

Fairly easy to add support for new problem variants.

Absolutely definitely totally 100% bug-free.

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 7 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

The Rest of this Talk

Finding subgraphs, from a constraint programming perspective.

A bit about the implementation.

Ongoing and future work.

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 8 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

The Idea

A set of variables, each of which has a finite domain of possiblevalues.

A set of constraints.

Give each variable a value from its domain, respecting allconstraints.

Solvers based upon inference and intelligent backtracking search.

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 9 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

Graph Mapping Problems

Variables are pa�ern graph vertices.

Values are target graph vertices.

Constraints for adjacency and injectivity.

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 10 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

Supplemental Constraints

Extra constraints using degrees, degree sequences, . . .Can reason about paths, not just adjacency.

Functors!

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 11 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

Supplemental Constraints

a b

c d

eP :1 2

3 45 6

T :

a b

c d

eP1+2:

1 23 4

5 6T 1+2:

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 11 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

Search

Branch on pa�ern vertices with fewest possibilities and mostconstraints.

Aggressive restarts and biased randomisation.

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 12 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

Side Constraints

Arbitrary additional “application” constraints.

More constraints usually means be�er performance.

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 13 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

A Dedicated Constraint Solver

“Modern” C++.Heavy use of bit-parallelism.

A full round of inference and propagation on a 40 vertex pa�ern,200 vertex target in 200ns.

Primarily run as an external process, unless your hostprogramming language can deal with threads and memorymanagement.

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 14 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

Proof Logging

Conventional testing techniques don’t work on solvers.

We can output a formally verifiable proof log in pseudo-Booleancu�ing planes format.

Doesn’t guarantee we’re bug-free, but if we ever output anincorrect answer, it can be detected.

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 15 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

Problem Variants

Bigraphs (with sharing).Can only map to some target vertices if there are no “extra”unmapped edges.

Matching with arbitrary side constraints.Highly experimental high level modelling language support.

Automatically detecting polynomial variants.

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 16 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

Symmetries and Other Ways of Counting Faster

For traditional constraint programming, counting isenumeration.

We can be exponentially faster in some situations.

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 17 / 18

Subgraph Problems Constraint Programming Implementation Details Ongoing Work

Automatic Configuration and Benchmarking

We need be�er benchmark instances!

Even if they’re really easy.

Or if they are so hard you can’t solve them at all.

Or if they have side constraints.

Ciaran McCreesh, Patrick Prosser, James Trimble

The Glasgow Subgraph Solver 18 / 18