In[]:=
ToCausalHypergraph[teg_]:=Module[{tokens,ins,outs},tokens=VertexList[teg,{"Expression",_}];​​{ins,outs}=Function[direction,DeleteCases[direction[teg,#,1],#]&/@tokens]/@{VertexInComponent,VertexOutComponent};​​Map[Last,DeleteCases[Thread[ins->outs],({}->_)|(_->{})],{3}]];
In[]:=
ToCausalHypergraph[ResourceFunction["WolframModel"][{{1,2},{2,3}}->{{1,3},{2,4},{4,3}},{{1,1},{1,1}},3,"EventSelectionFunction"->"MultiwaySpacelike"]["ExpressionsEventsGraph",VertexLabels->"Index"]]
Out[]=
{{1}{3,4,22,23,24,27},{1}{3,5,6,16,17,19},{1}{4,5,6,11,12,13,14},{2}{7,8,41,42,43,46},{2}{7,9,10,35,36,38},{2}{8,9,10,30,31,32,33},{3}{11,12},{3}{13,15},{3}{14,15},{4}{16,17,18},{4}{18,20,21},{4}{19,20,21},{5}{22,23,25},{5}{26},{5}{24,25,26},{6}{28},{6}{27,29},{6}{28,29},{7}{30,31},{7}{32,34},{7}{33,34},{8}{35,36,37},{8}{37,39,40},{8}{38,39,40},{9}{41,42,44},{9}{45},{9}{43,44,45},{10}{47},{10}{46,48},{10}{47,48}}
In[]:=
ToTokenHypergraph[teg_]:=Module[{tokens,ins,outs},tokens=VertexList[teg,{"Event",_}];​​{ins,outs}=Function[direction,DeleteCases[direction[teg,#,1],#]&/@tokens]/@{VertexInComponent,VertexOutComponent};​​Map[Last,DeleteCases[Thread[ins->outs],({}->_)|(_->{})],{3}]];
In[]:=
ToTokenHypergraph[ResourceFunction["WolframModel"][{{1,2},{2,3}}->{{1,3},{2,4},{4,3}},{{1,1},{1,1}},3,"EventSelectionFunction"->"MultiwaySpacelike"]["ExpressionsEventsGraph",VertexLabels->"Index"]]
Out[]=
{{1,2}{3,4,5},{1,2}{6,7,8},{3,4}{9,10,11},{3,5}{12,13,14},{4,5}{15,16,17},{4,5}{18,19,20},{6,7}{21,22,23},{6,8}{24,25,26},{7,8}{27,28,29},{7,8}{30,31,32},{5,9}{33,34,35},{5,9}{36,37,38},{5,10}{39,40,41},{5,11}{42,43,44},{10,11}{45,46,47},{4,12}{48,49,50},{4,12}{51,52,53},{12,13}{54,55,56},{4,14}{57,58,59},{13,14}{60,61,62},{13,14}{63,64,65},{3,15}{66,67,68},{3,15}{69,70,71},{3,17}{72,73,74},{15,17}{75,76,77},{16,17}{78,79,80},{3,19}{81,82,83},{18,20}{84,85,86},{19,20}{87,88,89},{8,21}{90,91,92},{8,21}{93,94,95},{8,22}{96,97,98},{8,23}{99,100,101},{22,23}{102,103,104},{7,24}{105,106,107},{7,24}{108,109,110},{24,25}{111,112,113},{7,26}{114,115,116},{25,26}{117,118,119},{25,26}{120,121,122},{6,27}{123,124,125},{6,27}{126,127,128},{6,29}{129,130,131},{27,29}{132,133,134},{28,29}{135,136,137},{6,31}{138,139,140},{30,32}{141,142,143},{31,32}{144,145,146}}