A reference page for the Hypergraph Toolkit: a small library for studying the adjacency tensors of hypergraphs. This code is written in Magma. More work needs to be done to implement this in python or other commonly used languages.
A hyperedge
To define the adjacency tensor of a d-uniform hypergraph
The adjacency tensor of a d-uniform hypergraph
We will continue to use this informal definition, but note that we are implicitly treating each vertex
In this package, all hyperedges are enumerated sets. So for the following hypergraph
the hyperedges are
Once hyperedges of the same cardinality are collected, the hypergraph is an ordered list of these collections of hyperedges. The ordering is according to the cardinality of the hyperedges. So the following hypergraph

is read as
For ease of compatibility, there is a function "OrganizeHypergraph" which takes in an enumerated set of hyperedges, i.e. {{1,2,3},{1,2},{1,2,3,5}}, and outputs hypergraphs in the expected format. This would allow us to initially store the previous hypergraph as
You must also specify your base field
The following is an example of how the program identifies features
unorganized_hypergraph:={{ 3 }, { 1 }, { 4 }, { 1, 3 }, { 1, 2 }, { 3, 4 },{ 1, 2, 3 }, { 2, 3, 4 }, { 3, 4, 5 }};
organized_hypergraph:=OrganizeHypergraph(unorganized_hypergraph);
d:=3; //Specify d-uniform hypergraph
K:=Rationals();
preserved_edges, discarded_edges, translations, hyperedge_history:= HyperDecomposition(organized_hypergraph,d,K);
discarded_edges; //shows which hyperedges were discarded at each step of the recursion
[*
[
[
{ 3 },
{ 1 },
{ 4 }
],
[
{ 1, 3 },
{ 1, 2 },
{ 3, 4 }
],
[]
]
*]
preserved_edges;//shows which hyperedges were not discarded at each step
[*
[
[],
[],
[
{ 2, 3, 4 },
{ 1, 2, 3 },
{ 3, 4, 5 }
]
]
*]
translations;//throughout the algorithm, vertices are relabeled
[* [* translation from initializing HG at first step,
Mapping from: {@ 3, 1, 4, 2, 5 @} to {@ 1, 2, 3, 4, 5 @}
<3, 3>
<1, 1>
<4, 4>
<2, 2>
<5, 5>
*], [* translation from creating tensor from hypergraph,
Mapping from: {@ 3, 1, 4, 2, 5 @} to {@ 1, 2, 3, 4, 5 @}
<3, 3>
<1, 1>
<4, 4>
<2, 2>
<5, 5>
*] *]
hyperedge_history;//Show where translations occur
[* [* hypergraph initialized at beginning of algorithm,
[
[
{ 3 },
{ 1 },
{ 4 }
],
[
{ 1, 3 },
{ 1, 2 },
{ 3, 4 }
],
[
{ 1, 2, 3 },
{ 2, 3, 4 },
{ 3, 4, 5 }
]
]
*], [* hypergraph cleaned in initial setup,
[
[
{ 3 },
{ 1 },
{ 4 }
],
[
{ 1, 3 },
{ 1, 2 },
{ 3, 4 }
],
[
{ 1, 2, 3 },
{ 2, 3, 4 },
{ 3, 4, 5 }
]
]
*], [* final discarded hypergraph at algorithm termination,
[
[],
[],
[
{ 2, 3, 4 },
{ 1, 2, 3 },
{ 3, 4, 5 }
]
]
*] *]
>
original_hypergraph:= [ [{ 3 }, { 1 }, { 4 }],
[{ 1, 3 }, { 1, 2 }, { 3, 4 }],
[{ 1, 2, 3 }, { 2, 3, 4 }, { 3, 4, 5 }] ];
permuted_hypergraph:=HGScrambler(original_hypergraph);
permuted_hypergraph;
[ [{ 1 }, { 2 }, { 5 }],
[{ 1, 2 }, { 2, 3 }, { 1, 5 }],
[{ 1, 2, 3 }, { 1, 3, 5 }, { 1, 4, 5 }] ]
The functions in Hypergraph creation give some automatic ways of generating hypergraphs
mountainrange:=MountainRangeMaker(4);
mountainrange;
[ [], [],
[{ 1, 2, 3 }, { 3, 4, 5 }, { 5, 6, 7}, {7, 8, 9}] ]
mountainrange:=MountainRangeMaker(3: dim:=4);//dim determines the cardinality of the mountains.
mountainrange;
[[],[],[],
[ { 1, 2, 3, 4 }, { 4, 5, 6, 7}, { 7, 8, 9, 10}] ]
The functions in Tests give various tests that can be done to the associated algebras, i.e. the derivation algebra.

