Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute the hypergraph with a specified adjacency tensor
ResourceFunction["AdjacencyHypergraph"][atens] gives the (ordered or orderless) hypergraph with adjacency tensor atens. |
"OrderedHyperedges" | Automatic | whether to treat hyperedges as being ordered (directed) |
Automatic | construct an orderless hypergraph if and only if the adjacency tensor is symmetric across all indices |
True | construct an ordered hypergraph |
False | construct an orderless hypergraph |
Construct an ordered hypergraph automatically from an asymmetric adjacency tensor:
In[1]:= |
|
Out[1]= |
|
Construct an orderless hypergraph automatically from a symmetric adjacency tensor:
In[2]:= |
|
Out[2]= |
|
Treat the hypergraph as being ordered instead:
In[3]:= |
|
Out[3]= |
|
Construct an ordered hypergraph of arity 5 automatically from an asymmetric adjacency tensor specified as a SparseArray:
In[4]:= |
|
Out[4]= |
|
AdjacencyHypergraph accepts both SparseArray and nested list specifications of adjacency tensors:
In[5]:= |
|
Out[5]= |
|
In[6]:= |
|
Out[6]= |
|
AdjacencyHypergraph supports multihypergraphs, with adjacency tensor entries representing hyperedge multiplicities:
In[7]:= |
|
Out[7]= |
|
When the rank of the adjacency tensor is equal to 2, the output of AdjacencyHypergraph is identical to the output of AdjacencyGraph:
In[8]:= |
|
Out[8]= |
|
In[9]:= |
|
Out[9]= |
|
In[10]:= |
|
Out[10]= |
|
When the adjacency tensor is symmetric across all indices, the hypergraph is automatically orderless:
In[11]:= |
|
Out[11]= |
|
In[12]:= |
|
Out[12]= |
|
In[13]:= |
|
Out[13]= |
|
When the adjacency tensor is asymmetric across any pair of indices, the hypergraph is automatically ordered:
In[14]:= |
|
Out[14]= |
|
In[15]:= |
|
Out[15]= |
|
In[16]:= |
|
Out[16]= |
|
Diagonal entries of the adjacency tensor specify self-loops in the hypergraph:
In[17]:= |
|
Out[17]= |
|
Adjacency tensors can be of arbitrary rank:
In[18]:= |
|
Out[18]= |
|
By default ("OrderedHyperedges"→Automatic), all hyperedges are treated as orderless (i.e. undirected) if the adjacency tensor is symmetric across all indices:
In[19]:= |
|
Out[19]= |
|
Use "OrderedHyperedges"→True to treat hyperedges as ordered (i.e. directed):
In[20]:= |
|
Out[20]= |
|
Conversely, all hyperedges are treated as ordered (i.e. directed) if the adjacency tensor is asymmetric across any pair of indices:
In[21]:= |
|
Out[21]= |
|
This work is licensed under a Creative Commons Attribution 4.0 International License