def contract_forest(self, forest): """ Contract the forest. Each tree of the forest is contracted to the initial vertex of its first edge. INPUT: - ``forest`` is a list of disjoint subtrees each given as lists of edges. OUTPUT: A dictionary that maps old edges to new edges. SEE ALSO: ``GraphWithInverses.contract_forest()`` """ contract_map = GraphWithInverses.contract_forest(self, forest) contract_morph = WordMorphism(contract_map) self._marking.set_edge_map(contract_morph * self._marking._edge_map) return contract_map
def contract_forest(self,forest): """ Contract the forest. OUTPUT: A dictionnary that maps old edges to new edges. SEE ALSO: ``GraphWithInverses.contract_forest()`` """ contract_map=GraphWithInverses.contract_forest(self,forest) contract_morph=WordMorphism(contract_map) self._marking.set_edge_map(contract_morph*self._marking._edge_map) return contract_map