7 unstable releases (3 breaking)

0.4.0-rc.2 Sep 10, 2024
0.3.1 Sep 9, 2024
0.2.0 Sep 3, 2024
0.1.1 Aug 27, 2024

#1528 in Data structures

Download history 260/week @ 2024-08-23 303/week @ 2024-08-30 271/week @ 2024-09-06 84/week @ 2024-09-13 18/week @ 2024-09-20 6/week @ 2024-09-27 2/week @ 2024-10-04

133 downloads per month

Apache-2.0

125KB
3K SLoC

Rust 2K SLoC // 0.1% comments TSX 766 SLoC // 0.0% comments TypeScript 151 SLoC // 0.0% comments JavaScript 9 SLoC // 0.3% comments

PortDiff

Data structure for fast local graph rewriting. Efficiently store and traverse hierarchies of deltas (diffs) of portgraphs.

Abstract

Graph rewriting is a powerful and general technique for optimisation problems on graphs. In the quantum computing domain, complete equational theories for quantum circuits provide strong theoretical foundations for rewriting. Unfortunately, rewriting-based circuit optimisation using a naive backtracking search is slow in practice, due to its poor scaling both in the number of rewrite rules and in the input circuit size, as well as being hard to parallelise.

We propose concurrent graph rewriting to address these issues, inspired from equality saturation for term rewriting. Rewrites can be applied in parallel on a persistent data structure. The data structure stores rewrites that can be applied either on the input circuit directly or following a sequence of previous rewrites. After an initial exploration phase, in which all possible rewrites are identified and added to the data structure, an extraction phase determines the set of rewrites that should be applied to optimise the circuit cost function. The exploration phase is designed to scale to large distributed systems, whilst the optimisation problem in the extraction phase can be solved using an off-the-shelf SMT solver.

Example

TODO

Dependencies

~3–4MB
~75K SLoC