-- | updates a typed graph morphism, mapping node n1 to node n2. It assumes both nodes already exist and are of the same type.
untypedUpdateNodeRelation :: NodeId -> NodeId -> TypedGraphMorphism a b -> TypedGraphMorphism a b
untypedUpdateNodeRelation n1 n2 tgm =
  TypedGraphMorphism { domainGraph = domainGraph tgm
                     , codomainGraph = codomainGraph tgm
                     , mapping = GM.updateNodeRelation n1 n2 (mapping tgm)
                     }
untypedUpdateNodeRelation :: NodeId -> NodeId -> TypedGraphMorphism a b -> TypedGraphMorphism a b
untypedUpdateNodeRelation n1 n2 tgm =
  TypedGraphMorphism { domainGraph = domainGraph tgm
                     , codomainGraph = codomainGraph tgm
                     , mapping = GM.updateNodeRelation n1 n2 (mapping tgm)
                     }
untypedUpdateNodeRelation n1 n2 tgm =
  TypedGraphMorphism { domainGraph = domainGraph tgm
                     , codomainGraph = codomainGraph tgm
                     , mapping = GM.updateNodeRelation n1 n2 (mapping tgm)
                     }