Skip to content

✨ Expose DD serialization/deserialization in Python API #1757

@mohammadSafwanAlam

Description

@mohammadSafwanAlam

Problem Statement

MQT Core exposes a useful Python API for constructing and manipulating DDs, but compressed DD persistence currently appears unavailable from Python. The available
Python paths are either dense (get_matrix / from_matrix) or visualization-oriented (to_dot), both of which are unsuitable for persisting large compressed DDs.

The C++ DD package already supports native serialization/deserialization. Would you be open to exposing that through mqt.core.dd, ideally as bytes-based APIs?

Proposed API shape:

  data = matrix_dd.to_bytes(binary=True)
  restored = dd_package.matrix_from_bytes(data, binary=True)

  data = serialize_matrix_dd(matrix_dd, binary=True)
  restored = deserialize_matrix_dd(dd_package, data, binary=True)

The bytes-based form avoids filesystem policy questions and lets downstream packages manage metadata/versioning themselves. This would let Python users cache verified
DD contracts without materializing exponential dense matrices or maintaining separate pybind shims.

Proposed Solution

Proposed API shape:

  data = matrix_dd.to_bytes(binary=True)
  restored = dd_package.matrix_from_bytes(data, binary=True)

  data = serialize_matrix_dd(matrix_dd, binary=True)
  restored = deserialize_matrix_dd(dd_package, data, binary=True)

Metadata

Metadata

Assignees

No one assigned

    Labels

    DDAnything related to the DD packagec++Anything related to C++ codeenhancementImprovement of existing featurepythonAnything related to Python code
    No fields configured for Feature.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions