.. _py-dg/GraphInterface: ********************************************************** dg/GraphInterface ********************************************************** .. default-domain:: py .. py:currentmodule:: mod .. cpp:namespace:: mod .. class:: DGVertex A descriptor of either a vertex in a derivation graph, or a null vertex. .. method:: __init__() Constructs a null descriptor. .. :method:: __bool__() :returns: ``not isNull()`` :rtype: bool .. method:: isNull() :returns: whether this is a null descriptor or not. :rtype: bool .. attribute:: id (Read-only) The index of the vertex. It will be in the range :math:`[0, numVertices + numEdges[`. :type: int :raises: :class:`LogicError` if it is a null descriptor. .. attribute:: dg (Read-only) The derivation graph the vertex belongs to. :type: DG :raises: :class:`LogicError` if it is a null descriptor. .. attribute:: inDegree (Read-only) The in-degree of the vertex, including multiplicity of target multisets. :type: int :raises: :class:`LogicError` if it is a null descriptor. .. attribute:: inEdges (Read-only) A range of in-hyperedges for this vertex. :type: DGInEdgeRange :raises: :class:`LogicError` if it is a null descriptor. .. attribute:: outDegree (Read-only) The out-degree of the vertex, including multiplicity of source multisets. :type: int :raises: :class:`LogicError` if it is a null descriptor. .. attribute:: outEdges (Read-only) A range of out-hyperedges for this vertex. :type: DGOutEdgeRange :raises: :class:`LogicError` if it is a null descriptor. .. attribute:: graph (Read-only) The graph label of the vertex. :type: Graph :raises: :class:`LogicError` if it is a null descriptor. .. class:: DGHyperEdge A descriptor of either a hyperedge in a derivation graph, or a null edge. .. method:: __init__() Constructs a null descriptor. .. :method:: __bool__() :returns: ``not isNull()`` :rtype: bool .. method:: isNull() :returns: whether this is a null descriptor or not. :rtype: bool .. attribute:: id (Read-only) The index of the hyperedge. It will be in the range :math:`[0, numVertices + numEdges[`. :type: int :raises: :class:`LogicError` if it is a null descriptor. .. attribute:: dg (Read-only) The derivation graph the edge belongs to. :type: DG :raises: :class:`LogicError` if it is a null descriptor. .. attribute:: numSources (Read-only) The number of sources of the hyperedge. :type: int .. attribute:: sources (Read-only) The sources of the hyperedge. :type: DGSourceRange :raises: :class:`LogicError` if it is a null descriptor. .. attribute:: numTargets (Read-only) The number of targets of the hyperedge. :type: int .. attribute:: targets (Read-only) The targets of the hyperedge. :type: DGTargetRange :raises: :class:`LogicError` if it is a null descriptor. .. attribute:: rules (Read-only) The rules associated with the hyperedge. :type: DGRuleRange :raises: :class:`LogicError` if it is a null descriptor. .. attribute:: inverse (Read-only) A descriptor for the inverse hyperedge of this one, if it exists. Otherwise a null descriptor is returned. :type: DGHyperEdge :raises: :class:`LogicError` if it is a null descriptor. :raises: :class:`LogicError` if not ``dg.locked``. .. method:: print(printer=GraphPrinter(), nomatchColour="gray", matchColour="", verbosity=0) Print the derivations represented by the hyperedge. All possible Double-Pushout diagrams are printed. :param GraphPrinter printer: the printer to use for the figures. :param str matchColour: the TikZ colour to use for the rule and its image in the bottom span. :param int verbosity: see :cpp:func:`dg::DG::HyperEdge::print`. :returns: A list with file data for each DPO diagram printed. Each element is a pair of filename prefixes, where the first entry is completed by appending ``_derL``, ``_derK``, or ``_derR``. The second entry is completed similarly by appending ``_derG``, ``_derD``, or ``_derH``. :rtype: list[tuple[str, str]] :raises: :class:`LogicError` if it is a null descriptor. :raises: :class:`LogicError` if it has no rules.