Ejemplo n.º 1
0
     def subdivide(self,edge_list):
          """
          Subdivides edges in the edge_list into two edges.

          WARNING:

          each edge in ``edge_list`` must appear only once.

          SEE ALSO:

          ``GraphWithInverses.subdivide()``
          """

          subdivide_map=GraphWithInverses.subdivide(self,edge_list)
          subdivide_morph=WordMorphism(subdivide_map)
          self._marking.set_edge_map(subdivide_morph*self._marking._edge_map)
          return subdivide_map
    def subdivide(self, edge_list):
        """
        Subdivides each edge in the edge_list into two edges.

        INPUT:

        - ``edge_list`` edge list

        OUTPUT:
        subdivide  map from subdivide GraphWithInverses

        WARNING:

        each edge in ``edge_list`` must appear only once.

        EXAMPLES::

            sage: G = GraphWithInverses([[0,0,'a'],[0,1,'b'],[1,1,'c']])
            sage: G = MarkedGraph(G)
            sage: G.subdivide(['a','c'])
            {'A': word: DA,
             'B': word: B,
             'C': word: EC,
             'a': word: ad,
             'b': word: b,
             'c': word: ce}
            sage: print G
            Marked graph: a: 0->2, b: 0->1, c: 1->3, d: 2->0, e: 3->1
            Marking: a->ad, b->bceB

        SEE ALSO::

        GraphWithInverses.subdivide()
        """

        subdivide_map = GraphWithInverses.subdivide(self, edge_list)
        subdivide_morph = WordMorphism(subdivide_map)
        self._marking.set_edge_map(subdivide_morph * self._marking._edge_map)
        return subdivide_map