.. _py-rule/GraphInterface: ********************************************************** rule/GraphInterface ********************************************************** .. default-domain:: py .. py:currentmodule:: mod .. cpp:namespace:: mod .. class:: Rule.LeftGraph A proxy object representing the left graph of the rule. The class implements the :class:`protocols.LabelledGraph` protocol, .. attribute:: rule (Read-only) The rule the graph belongs to. :type: Rule .. class:: Vertex A descriptor of either a vertex in a left side, or a null vertex. Implements the :class:`protocols.LabelledGraph.Vertex` protocol. Additionally, the :attr:`id ` is in the range :math:`[0, numCoreVertices[`. .. attribute:: core (Read-only) The descriptor for this vertex in the core graph. :type: Rule.Vertex .. attribute:: rule (Read-only) The rule the vertex belongs to. :type: Rule :raises: :class:`LogicError` if it is a null descriptor. .. class:: Edge A descriptor of either an edge in a left side, or a null edge. Implements the :class:`protocols.LabelledGraph.Edge` protocol. .. attribute:: core (Read-only) The descriptor for this edge in the core graph. :type: Rule.Edge .. attribute:: rule (Read-only) The rule the edge belongs to. :type: Rule :raises: :class:`LogicError` if it is a null descriptor. .. class:: VertexRange Implements the :class:`protocols.Graph.VertexRange` protocol. .. class:: EdgeRange Implements the :class:`protocols.Graph.EdgeRange` protocol. .. class:: IncidentEdgeRange Implements the :class:`protocols.Graph.IncidentEdgeRange` protocol. .. class:: Rule.ContextGraph A proxy object representing the context graph of the rule. The class implements the :class:`protocols.Graph` protocol, .. attribute:: rule (Read-only) The rule the graph belongs to. :type: Rule .. class:: Vertex A descriptor of either a vertex in a context, or a null vertex. Implements the :class:`protocols.Graph.Vertex` protocol. Additionally, the :attr:`id ` is in the range :math:`[0, numCoreVertices[`. .. attribute:: core (Read-only) The descriptor for this vertex in the core graph. :type: Rule.Vertex .. attribute:: rule (Read-only) The rule the vertex belongs to. :type: Rule :raises: :class:`LogicError` if it is a null descriptor. .. class:: Edge A descriptor of either an edge in a context, or a null edge. Implements the :class:`protocols.LabelledGraph.Edge` protocol. .. attribute:: core (Read-only) The descriptor for this edge in the core graph. :type: Rule.Edge .. attribute:: graph (Read-only) The rule the edge belongs to. :type: Rule :raises: :class:`LogicError` if it is a null descriptor. .. class:: VertexRange Implements the :class:`protocols.Graph.VertexRange` protocol. .. class:: EdgeRange Implements the :class:`protocols.Graph.EdgeRange` protocol. .. class:: IncidentEdgeRange Implements the :class:`protocols.Graph.IncidentEdgeRange` protocol. .. class:: Rule.RightGraph A proxy object representing the right graph of the rule. The class implements the :class:`protocols.LabelledGraph` protocol, .. attribute:: rule (Read-only) The rule the graph belongs to. :type: Rule .. class:: Vertex A descriptor of either a vertex in a right side, or a null vertex. Implements the :class:`protocols.LabelledGraph.Vertex` protocol. Additionally, the :attr:`id ` is in the range :math:`[0, numCoreVertices[`. .. attribute:: core (Read-only) The descriptor for this vertex in the core graph. :type: Rule.Vertex .. attribute:: rule (Read-only) The rule the vertex belongs to. :type: Rule :raises: :class:`LogicError` if it is a null descriptor. .. class:: Edge A descriptor of either an edge in a right side, or a null edge. Implements the :class:`protocols.LabelledGraph.Edge` protocol. .. attribute:: core (Read-only) The descriptor for this edge in the core graph. :type: Rule.Edge .. attribute:: rule (Read-only) The rule the edge belongs to. :type: Rule :raises: :class:`LogicError` if it is a null descriptor. .. class:: VertexRange Implements the :class:`protocols.Graph.VertexRange` protocol. .. class:: EdgeRange Implements the :class:`protocols.Graph.EdgeRange` protocol. .. class:: IncidentEdgeRange Implements the :class:`protocols.Graph.IncidentEdgeRange` protocol. .. class:: Rule.Vertex Implements the :class:`protocols.Graph.Vertex` protocol. Additionally, the :attr:`id ` is in the range :math:`[0, numVertices[`. .. attribute:: rule An alias for :attr:`protocols.Graph.Vertex.graph`. :type: Rule .. attribute:: left (Read-only) A null descriptor if this vertex is not in the left graph, otherwise the descriptor of this vertex in the left graph. :type: LeftGraph.Vertex .. attribute:: context (Read-only) A null descriptor if this vertex is not in the context graph, otherwise the descriptor of this vertex in the context graph. :type: ContextGraph.Vertex .. attribute:: right (Read-only) A null descriptor if this vertex is not in the right graph, otherwise the descriptor of this vertex in the right graph. :type: RightGraph.Vertex .. method:: get2DX(withHydrogens=True) :returns: the x-coordinate in a 2D depiction of the rule. Different sets of coordinates exists for rendering with and without certain hydrogens. :rtype: float :raises: :class:`LogicError` if it is a null descriptor, or if ``withHydrogens`` is ``True`` and the vertex is a "clean" hydrogen. .. method:: get2DY(withHydrogens=True) :returns: the y-coordinate in a 2D depiction of the rule. Different sets of coordinates exists for rendering with and without certain hydrogens. :rtype: float :raises: :class:`LogicError` if it is a null descriptor, or if ``withHydrogens`` is ``True`` and the vertex is a "clean" hydrogen. .. class:: Rule.Edge Implements the :class:`protocols.Graph.Edge` protocol. .. attribute:: rule An alias for :attr:`protocols.Graph.Edge.graph`. :type: Rule .. attribute:: left (Read-only) A null descriptor if this edge is not in the left graph, otherwise the descriptor of this edge in the left graph. :type: LeftGraph.Edge .. attribute:: context (Read-only) A null descriptor if this edge is not in the context graph, otherwise the descriptor of this edge in the context graph. :type: ContextGraph.Edge .. attribute:: right (Read-only) A null descriptor if this edge is not in the right graph, otherwise the descriptor of this edge in the right graph. :type: RightGraph.Edge .. class:: Rule.VertexRange Implements the :class:`protocols.Graph.VertexRange` protocol, in addition to the following functionality. .. method:: __getitem__(i) :returns: the ``i``\ th vertex of the graph. :rtype: Rule.Vertex .. class:: Rule.EdgeRange Implements the :class:`protocols.Graph.EdgeRange` protocol. .. class:: Rule.IncidentEdgeRange Implements the :class:`protocols.Graph.IncidentEdgeRange` protocol.