Skip to content

scram::core::pdag

Functions

Name
template <class T > <br>std::vector< T * >OrderArguments(Gate * gate)<br>Determines the order of traversal for gate arguments.
voidTopologicalOrder(Pdag * graph)<br>Assigns topological ordering to nodes of the PDAG.
voidMarkCoherence(Pdag * graph)<br>Marks coherence of the whole graph.
template <typename T ,typename... Ts> <br>voidTransform(Pdag * graph, T && unary_op, Ts &&... unary_ops)<br>Applies graph transformations consecutively.

Functions Documentation

function OrderArguments

cpp
template <class T >
std::vector< T * > OrderArguments(
    Gate * gate
)

Determines the order of traversal for gate arguments.

Parameters:

  • gate The host gate parent.

Template Parameters:

  • T Type of the arguments.

Return: An ordered, stable list of arguments.

This function does not assign the order of nodes.

function TopologicalOrder

cpp
void TopologicalOrder(
    Pdag * graph
)

Assigns topological ordering to nodes of the PDAG.

Parameters:

  • graph The graph to be processed.

Postcondition: The root and descendant node order marks contain the ordering.

The ordering is assigned to the node order marks. The nodes are sorted in descending optimization value. The highest order value belongs to the root.

function MarkCoherence

cpp
void MarkCoherence(
    Pdag * graph
)

Marks coherence of the whole graph.

Parameters:

  • graph The graph to be processed.

Postcondition: Gate traversal marks are dirty.

function Transform

cpp
template <typename T ,
typename... Ts>
void Transform(
    Pdag * graph,
    T && unary_op,
    Ts &&... unary_ops
)

Applies graph transformations consecutively.

Parameters:

  • graph The graph to be transformed.
  • unary_op The first operation to be applied.
  • unary_ops The rest of transformations to apply.

Updated on 2025-11-11 at 16:51:08 +0000