.. _py-rule/GraphInterface: ********************************************************** rule/GraphInterface ********************************************************** .. default-domain:: py .. py:currentmodule:: mod .. cpp:namespace:: mod Class ``RuleLeftGraph`` -------------------------------------------------------------------------------------------------------------------------------- .. py:class:: RuleLeftGraph A proxy object representing the left graph of the rule. .. py:attribute:: rule (Read-only) The rule the graph belongs to. :type: Rule .. py:attribute:: numVertices (Read-only) The number of vertices in the graph. :type: int .. py:attribute:: vertices (Read-only) An iterable of all vertices in the graph. :type: RuleLeftGraphVertexRange .. py:attribute:: numEdges (Read-only) The number of edges in the graph. :type: int .. py:attribute:: edges (Read-only) An iterable of all edges in the graph. :type: RuleLeftGraphEdgeRange Class ``RuleLeftGraphVertex`` -------------------------------------------------------------------------------------------------------------------------------- .. py:class:: RuleLeftGraphVertex A descriptor of either a vertex in a left side, or a null vertex. .. py:function:: __init__(self) Constructs a null descriptor. .. py::method:: __bool__(self) :returns: ``not isNull()`` :rtype: bool .. py:method:: isNull() :returns: whether this is a null descriptor or not. :rtype: bool .. py:attribute:: id (Read-only) The index of the vertex. It will be in the range :math:`[0, numCoreVertices[`. :type: int :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: rule (Read-only) The rule the vertex belongs to. :type: Rule :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: core (Read-only) The descriptor for this vertex in the core graph. :type: RuleVertex .. py:attribute:: degree (Read-only) The degree of the vertex. :type: int :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: incidentEdges (Read-only) A range of incident edges to this vertex. :type: RuleLeftGraphIncidentEdgeRange :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: stringLabel (Read-only) The string label of the vertex. :type: str :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: atomId (Read-only) The atom id of the vertex. :type: AtomId :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: isotope (Read-only) The isotope of the vertex. :type: Isotope :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: charge (Read-only) The charge of the vertex. :type: Charge :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: radical (Read-only) The radical status of the vertex. :type: bool :raises: :py:class:`LogicError` if it is a null descriptor. .. py:method:: printStereo() printStereo(p) Print the stereo configuration for the vertex. :param GraphPrinter p: the printing options used for the depiction. :returns: the name of the PDF-file that will be compiled in post-processing. :rtype: str :raises: :py:class:`LogicError` if it is a null descriptor. Class ``RuleLeftGraphEdge`` -------------------------------------------------------------------------------------------------------------------------------- .. py:class:: RuleLeftGraphEdge A descriptor of either an edge in a left side, or a null edge. .. py:function:: __init__(self) Constructs a null descriptor. .. py::method:: __bool__(self) :returns: ``not isNull()`` :rtype: bool .. py:method:: isNull() :returns: whether this is a null descriptor or not. :rtype: bool .. py:attribute:: graph (Read-only) The rule the edge belongs to. :type: Rule :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: core (Read-only) The descriptor for this edge in the core graph. :type: RuleEdge .. py:attribute:: source (Read-only) The source vertex of the edge. :type: RuleLeftGraphVertex :raises: :py:class:`LogicError` if it is a null descriptor. .. attribute:: target (Read-only) The target vertex of the edge. :type: RuleLeftGraphVertex :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: stringLabel (Read-only) The string label of the edge. :type: str :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: bondType (Read-only) The bond type of the edge. :type: BondType :raises: :py:class:`LogicError` if it is a null descriptor. Class ``RuleContextGraph`` -------------------------------------------------------------------------------------------------------------------------------- .. py:class:: RuleContextGraph A proxy object representing the context graph of the rule. .. py:attribute:: rule (Read-only) The rule the graph belongs to. :type: Rule .. py:attribute:: numVertices (Read-only) The number of vertices in the graph. :type: int .. py:attribute:: vertices (Read-only) An iterable of all vertices in the graph. :type: RuleContextGraphVertexRange .. py:attribute:: numEdges (Read-only) The number of edges in the graph. :type: int .. py:attribute:: edges (Read-only) An iterable of all edges in the graph. :type: RuleContextGraphEdgeRange Class ``RuleContextGraphVertex`` -------------------------------------------------------------------------------------------------------------------------------- .. py:class:: RuleContextGraphVertex A descriptor of either a vertex in a context, or a null vertex. .. py:function:: __init__(self) Constructs a null descriptor. .. py::method:: __bool__(self) :returns: ``not isNull()`` :rtype: bool .. py:method:: isNull() :returns: whether this is a null descriptor or not. :rtype: bool .. py:attribute:: id (Read-only) The index of the vertex. It will be in the range :math:`[0, numCoreVertices[`. :type: int :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: rule (Read-only) The rule the vertex belongs to. :type: Rule :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: core (Read-only) The descriptor for this vertex in the core graph. :type: RuleVertex .. py:attribute:: degree (Read-only) The degree of the vertex. :type: int :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: incidentEdges (Read-only) A range of incident edges to this vertex. :type: RuleContextGraphIncidentEdgeRange :raises: :py:class:`LogicError` if it is a null descriptor. Class ``RuleContextGraphEdge`` -------------------------------------------------------------------------------------------------------------------------------- .. py:class:: RuleContextGraphEdge A descriptor of either an edge in a context, or a null edge. .. py:function:: __init__(self) Constructs a null descriptor. .. py::method:: __bool__(self) :returns: ``not isNull()`` :rtype: bool .. py:method:: isNull() :returns: whether this is a null descriptor or not. :rtype: bool .. py:attribute:: graph (Read-only) The rule the edge belongs to. :type: Rule :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: core (Read-only) The descriptor for this edge in the core graph. :type: RuleEdge .. py:attribute:: source (Read-only) The source vertex of the edge. :type: RuleContextGraphVertex :raises: :py:class:`LogicError` if it is a null descriptor. .. attribute:: target (Read-only) The target vertex of the edge. :type: RuleContextGraphVertex :raises: :py:class:`LogicError` if it is a null descriptor. Class ``RuleRightGraph`` -------------------------------------------------------------------------------------------------------------------------------- .. py:class:: RuleRightGraph A proxy object representing the right graph of the rule. .. py:attribute:: rule (Read-only) The rule the graph belongs to. :type: Rule .. py:attribute:: numVertices (Read-only) The number of vertices in the graph. :type: int .. py:attribute:: vertices (Read-only) An iterable of all vertices in the graph. :type: RuleRightGraphVertexRange .. py:attribute:: numEdges (Read-only) The number of edges in the graph. :type: int .. py:attribute:: edges (Read-only) An iterable of all edges in the graph. :type: RuleRightGraphEdgeRange Class ``RuleRightGraphVertex`` -------------------------------------------------------------------------------------------------------------------------------- .. py:class:: RuleRightGraphVertex A descriptor of either a vertex in a right side, or a null vertex. .. py:function:: __init__(self) Constructs a null descriptor. .. py::method:: __bool__(self) :returns: ``not isNull()`` :rtype: bool .. py:method:: isNull() :returns: whether this is a null descriptor or not. :rtype: bool .. py:attribute:: id (Read-only) The index of the vertex. It will be in the range :math:`[0, numCoreVertices[`. :type: int :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: rule (Read-only) The rule the vertex belongs to. :type: Rule :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: core (Read-only) The descriptor for this vertex in the core graph. :type: RuleVertex .. py:attribute:: degree (Read-only) The degree of the vertex. :type: int :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: incidentEdges (Read-only) A range of incident edges to this vertex. :type: RuleRightGraphIncidentEdgeRange :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: stringLabel (Read-only) The string label of the vertex. :type: str :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: atomId (Read-only) The atom id of the vertex. :type: AtomId :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: isotope (Read-only) The isotope of the vertex. :type: Isotope :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: charge (Read-only) The charge of the vertex. :type: Charge :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: radical (Read-only) The radical status of the vertex. :type: bool :raises: :py:class:`LogicError` if it is a null descriptor. .. py:method:: printStereo() printStereo(p) Print the stereo configuration for the vertex. :param GraphPrinter p: the printing options used for the depiction. :returns: the name of the PDF-file that will be compiled in post-processing. :rtype: str :raises: :py:class:`LogicError` if it is a null descriptor. Class ``RuleRightGraphEdge`` -------------------------------------------------------------------------------------------------------------------------------- .. py:class:: RuleRightGraphEdge A descriptor of either an edge in a right side, or a null edge. .. py:function:: __init__(self) Constructs a null descriptor. .. py::method:: __bool__(self) :returns: ``not isNull()`` :rtype: bool .. py:method:: isNull() :returns: whether this is a null descriptor or not. :rtype: bool .. py:attribute:: graph (Read-only) The rule the edge belongs to. :type: Rule :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: core (Read-only) The descriptor for this edge in the core graph. :type: RuleEdge .. py:attribute:: source (Read-only) The source vertex of the edge. :type: RuleRightGraphVertex :raises: :py:class:`LogicError` if it is a null descriptor. .. attribute:: target (Read-only) The target vertex of the edge. :type: RuleRightGraphVertex :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: stringLabel (Read-only) The string label of the edge. :type: str :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: bondType (Read-only) The bond type of the edge. :type: BondType :raises: :py:class:`LogicError` if it is a null descriptor. Class ``RuleVertex`` -------------------------------------------------------------------------------------------------------------------------------- .. py:class:: RuleVertex A descriptor of either a vertex in a rule, or a null vertex. .. py:function:: __init__(self) Constructs a null descriptor. .. py::method:: __bool__(self) :returns: ``not isNull()`` :rtype: bool .. py:method:: isNull() :returns: whether this is a null descriptor or not. :rtype: bool .. py:attribute:: id (Read-only) The index of the vertex. It will be in the range :math:`[0, numVertices[`. :type: int :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: rule (Read-only) The rule the vertex belongs to. :type: Rule :raises: :py:class:`LogicError` if it is a null descriptor. .. py: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. .. py: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. .. py: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. .. py:attribute:: degree (Read-only) The degree of the vertex. :type: int :raises: :py:class:`LogicError` if it is a null descriptor. .. py:attribute:: incidentEdges (Read-only) A range of incident edges to this vertex. :type: RuleIncidentEdgeRange :raises: :py:class:`LogicError` if it is a null descriptor. .. py:method:: get2DX(withHydrogens=True) :returns: the x-coordinate in a 2D depiction of the rule. Different sets of coordinates exists for rendering with and wihout certain hydrogens. :rtype: float :raises: :py:class:`LogicError` if it is a null descriptor, or if ``withHydrogens`` is ``True`` and the vertex is a "clean" hydrogen. .. py:method:: get2DY(withHydrogens=True) :returns: the y-coordinate in a 2D depiction of the rule. Different sets of coordinates exists for rendering with and wihout certain hydrogens. :rtype: float :raises: :py:class:`LogicError` if it is a null descriptor, or if ``withHydrogens`` is ``True`` and the vertex is a "clean" hydrogen. Class ``RuleEdge`` -------------------------------------------------------------------------------------------------------------------------------- .. py:class:: RuleEdge A descriptor of either an edge in a rule, or a null edge. .. py:function:: __init__(self) Constructs a null descriptor. .. py::method:: __bool__(self) :returns: ``not isNull()`` :rtype: bool .. py:method:: isNull() :returns: whether this is a null descriptor or not. :rtype: bool .. py:attribute:: rule (Read-only) The rule the edge belongs to. :type: Rule :raises: :py:class:`LogicError` if it is a null descriptor. .. py: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. .. py: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. .. py: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. .. py:attribute:: source (Read-only) The source vertex of the edge. :type: RuleVertex :raises: :py:class:`LogicError` if it is a null descriptor. .. attribute:: target (Read-only) The target vertex of the edge. :type: RuleVertex :raises: :py:class:`LogicError` if it is a null descriptor.