.. _py-dg/VertexMapper: ********************************************************** dg/VertexMapper ********************************************************** .. default-domain:: py .. py:currentmodule:: mod .. cpp:namespace:: mod .. class:: DGVertexMapper A class for enumerating all valid vertex maps for a given :class:`DGHyperEdge`. That is, for such a hyperedge, collect the graphs associated with respectively the source and target vertices, and create the disjoint union of those graphs. Let the result be the graphs :math:`G` and :math:`H`. Then each rule :math:`r` associated with the hyperedge, calculate each direct derivation :math:`G \overset{r}{\Rightarrow} H` and record the associated vertex maps :math:`V(G) \rightarrow V(H)`. Those maps are available in this class. .. method:: __init__(e) Perform the vertex map calculation. :param DGHyperEdge e: the hyperedge to calculate vertex maps for. :raises: :class:`LogicError` if ``not e``. .. attribute:: edge (Read-only) The hyperedge to calculate vertex maps for. :type: DGHyperEdge .. attribute:: left right :returns: the disjoint union of graphs from respectively the source and target vertices of the hyperedge. That is, the graphs :math:`G` and :math:`H` that are the domain and codomain graphs of the calculated vertex maps. :type: UnionGraph .. method:: __iter__() :returns: an iterator over the vertex maps, see :meth:`__getitem__` for the specific type. .. attribute:: size (Read-only) The number of vertex maps calculated. :type: int .. method:: __len__() :returns: :attr:`size` :rtype: int .. method:: __getitem__(i) :param int i: the index of the map to retrieve. :returns: the ``i``\ th vertex map. :rtype: tuple[Rule, VertexMapUnionGraphUnionGraph] :raises: :class:`LogicError` if ``i`` is out of range.