4.1.8.5. causality/RealisabilityQuery

class causality.RealisabilityQuery

Representation of a query for a DAG that can be folded back into a given flow. The query is based on a derivation graph and can thus be used for any flow solution from a model based on that derivation graph.

See also [ABFFMS-Realisability].

__init__(dg)

Construct a query with multiplicity 1 and no borrowing.

Raises:

LogicError if dg is None.

dg

(Read-only) The underlying derivation graph.

Type:

DG

multiplicity

Access the multiplicity of the query. It must be at least 1.

Type:

int

Raises:

(set) LogicError if assigned a number less than 1.

__setitem__(v, count)
__setitem__(g, count)

Set the amount of flow allowed to be borrowed at a given vertex. The version taking a graph as argument is equivalent to self[self.dg.findVertex(g)].

Parameters:
  • v (DG.Vertex) – a vertex in the derivation graph the query is intended for.

  • g (Graph) – a graph representing a vertex in the derivation graph the query is intended for.

  • count (int) – the amount of tokens to allowed to be borrowed in a solution.

__getitem__(v)
__getitem__(g)
Parameters:
  • v (DG.Vertex) – a vertex in the derivation graph the query is intended for.

  • g (Graph) – a graph representing a vertex in the derivation graph the query is intended for.

Return type:

int

Returns:

the amount of flow allowed to be borrowed at a given vertex. The version taking a graph as argument is equivalent to self[self.dg.findVertex(g)].

respectTransit

Access whether transit edges must conform to how they are used in the flow. Setting this to False may give results violating flow constraints.

findDAG(s)
Parameters:

s (hyperflow.Solution) – the flow solution to query for a causality DAG.

Returns:

a causality DAG that can be folded back into the given flow solution, using the query settings in this object, if one can be found.

Return type:

Optional[DAG]

Raises:

LogicError if any graph g given as self[g] with non-zero count is not a vertex in the underlying derivation graph of the given flow solution, i.e., if self.dg.findVertex(g) returns a null vertex.