In[]:=
WMUnifications[h1_,h2_]:=WolframModelPlot[#,EdgeStyleReplacePart[Table[Automatic,Length[#]],Join[Thread[Intersection[Values[#2],Values[#3]]Purple],Thread[Values[#2]Red],Thread[Values[#3]Blue]]],VertexLabelsAutomatic]&@@@HypergraphUnifications[h1,h2]
In[]:=
HypergraphUnifications[{{x,y},{x,z}},{{x,y},{x,z}}]
Out[]=
In[]:=
WolframModelPlot[{{x,y},{x,z}},VertexLabelsAutomatic,EdgeStyleRed]
Out[]=
In[]:=
WolframModelPlot[{{a,b},{a,c}},VertexLabelsAutomatic,EdgeStyleBlue]
Out[]=
In[]:=
HypergraphUnifications[{{x,y},{x,z}},{{a,b},{a,c}}]
Out[]=
In[]:=
WMUnifications[{{x,y},{x,z}},{{x,y},{x,z}}]
Out[]=
In[]:=
HypergraphUnifications[{{1,2}},{{3,4}}]
Out[]=
{{{{1,2}},11,11}}
In[]:=
HypergraphUnifications[{{1,2}},{{3,4,5}}]
should give { }
In[]:=
HypergraphUnifications[{{1,1}},{{2,3}}]
Out[]=
{{{{1,1}},11,11}}
In[]:=
WMUnifications[{{1,1}},{{2,3}}]
Out[]=


Trying find the minimal hypergraph that matches both patterns from the two constituent hypergraphs
(more general than strings) AB BA -> ABA , BAB not ABBA because disconnected
In[]:=
WolframModelPlot[{{x,y},{x,z,w}},VertexLabelsAutomatic,EdgeStyleRed]
Out[]=
In[]:=
WolframModelPlot[{{a,b},{a,c}},VertexLabelsAutomatic,EdgeStyleBlue]
Out[]=
In[]:=
WMUnifications[{{x,y},{x,z,w}},{{x,y},{x,z}}]
Out[]=
In[]:=
WolframModelPlot[{{x,y},{x,z,w}},VertexLabelsAutomatic,EdgeStyleRed]
Out[]=
In[]:=
WolframModelPlot[{{a,b},{a,a}},VertexLabelsAutomatic,EdgeStyleBlue]
Out[]=
In[]:=
WMUnifications[{{x,y},{x,z,w}},{{x,y},{x,x}}]
Out[]=

For CI checking

In[]:=
WolframModelPlot[{{x,y},{x,z}},VertexLabelsAutomatic,EdgeStyleRed]
Out[]=
In[]:=
WolframModelPlot[{{a,b},{a,c}},VertexLabelsAutomatic,EdgeStyleBlue]
Out[]=
In[]:=
HypergraphUnifications[{{x,y},{x,z}},{{a,b},{a,c}}]
Out[]=
In[]:=
WMUnifications[{{x,y},{x,z}},{{x,y},{x,z}}]
Out[]=
For purpose of c.i. testing, only care about structure of unified hypergraph, not the mappings....
This produces a trivial critical pair

Particular Case

Strings