Placement

class pytket_dqc.placement.placement.Placement(placement: dict[int, int])

Placement of hypergraph onto server network.

Parameters:

placement (dict[int, int]) – Dictionary mapping hypergraph vertices to server indexes.

__init__(placement: dict[int, int])
is_valid(circuit: HypergraphCircuit, network: NISQNetwork) bool

Check if placement is valid. In particular check that no more qubits are allotted to a server than can be accommodated.

Parameters:
  • circuit (HypergraphCircuit) – Circuit being placed onto network by placement.

  • network (NISQNetwork) – Network circuit is placed onto by placement.

Returns:

Is a valid placement.

Return type:

bool

get_distribution_tree(hyperedge: list[int], qubit_node: int, network: NISQNetwork) List[Tuple[int, int]]

Returns tree representing the edges along which distribution operations should act. This is the steiner tree covering the servers used by the vertices in the hyper edge.

Parameters:
  • hyperedge (list[int]) – Hyperedge for which distribution graph should be found.

  • qubit_node (int) – Node in hyperedge which corresponds to a qubit.

  • network (NISQNetwork) – Network onto which hyper edge should be distributed.

Returns:

List of edges along which distribution gates should act, with the direction and order in this they should act.

Return type:

List[List[int]]

to_dict() dict[int, int]

Generate JSON serialisable dictionary for the Placement.

Returns:

Dictionary serialisation of the Placement.

Return type:

dict[int, int]

classmethod from_dict(placement_dict: dict[int, int])

Generate Placement instance from JSON serialisable dictionary.

Parameters:

placement_dict (dict[int, int]) – JSON serialisable dictionary representation of the Placement.

Returns:

Placement instance constructed from placement_dict.

Return type:

Placement