Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Convert a hypergraph to a graph with the same distance matrix
| ResourceFunction["HypergraphToGraph"][hg] converts the ordered hypergraph hg to a directed graph with the same distance matrix. | 
Convert a simple hypergraph to a graph:
| In[1]:= | ![ResourceFunction["HypergraphToGraph"][{{1, 3, 2}, {2, 1, 3}}]](https://www.wolframcloud.com/obj/resourcesystem/images/826/8267b84f-863c-449c-a2ae-408b71ce21f0/00aa87b70f62cccd.png)  | 
| Out[1]= |   | 
Find the edge list of the resulting graph:
| In[2]:= | ![EdgeList[%]](https://www.wolframcloud.com/obj/resourcesystem/images/826/8267b84f-863c-449c-a2ae-408b71ce21f0/3ae1f55f0dbc1872.png)  | 
| Out[2]= |   | 
Define a more complex hypergraph:
| In[3]:= |   | 
Find the equivalent graph:
| In[4]:= | ![ResourceFunction["HypergraphToGraph"][hg, VertexLabels -> Automatic]](https://www.wolframcloud.com/obj/resourcesystem/images/826/8267b84f-863c-449c-a2ae-408b71ce21f0/352025b53993aaaf.png)  | 
| Out[4]= |   | 
This work is licensed under a Creative Commons Attribution 4.0 International License