Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute the Kirchhoff tensor (Laplacian) of an arbitrary hypergraph
ResourceFunction["KirchhoffTensor"][h] gives the Kirchhoff tensor of the (ordered or orderless) hypergraph h. |
| "OrderedHyperedges" | False | whether to treat hyperedges as being ordered (directed) |
| "OrderedHyperedgeDegree" | "InOutDegree" | which notion of vertex degree to use for ordered (directed) hypergraphs |
| "InOutDegree" | treat the degree of a vertex in an ordered (directed) hypergraph as the sum of its in- and out-degrees |
| "InDegree" | treat the degree of a vertex in an ordered (directed) hypergraph as its in-degree |
| "OutDegree" | treat the degree of a vertex in an ordered (directed) hypergraph as its out-degree |
The Kirchhoff tensor of an orderless hypergraph, with hyperedges of arity 3:
| In[1]:= |
|
| Out[1]= |
|
| In[2]:= |
|
| Out[2]= |
|
The Kirchhoff tensor of an ordered hypergraph, with hyperedges of arity 3:
| In[3]:= |
|
| Out[3]= |
|
| In[4]:= |
|
| Out[4]= |
|
Use only vertex in-degrees along the main diagonal:
| In[5]:= |
|
| Out[5]= |
|
| In[6]:= |
|
| Out[6]= |
|
The Kirchhoff tensor of an orderless hypergraph, with hyperedges of arity 5:
| In[7]:= |
|
| Out[7]= |
|
KirchhoffTensor supports multihypergraphs, in which case the off-diagonal tensor entries represent hyperedge multiplicities:
| In[8]:= |
|
| Out[8]= |
|
| In[9]:= |
|
| Out[9]= |
|
When the arity of hyperedges is equal to 2, the output of KirchhoffTensor is identical to the output of KirchhoffMatrix:
| In[10]:= |
|
| Out[10]= |
|
| In[11]:= |
|
| Out[11]= |
|
| In[12]:= |
|
| Out[12]= |
|
The Kirchhoff tensor of an orderless hypergraph is always symmetric across all indices:
| In[13]:= |
|
| Out[13]= |
|
| In[14]:= |
|
| Out[14]= |
|
The Kirchhoff tensor of an ordered hypergraph is not necessarily symmetric across all indices:
| In[15]:= |
|
| Out[15]= |
|
| In[16]:= |
|
| Out[16]= |
|
KirchhoffTensor automatically removes self-loops from a hypergraph:
| In[17]:= |
|
| Out[17]= |
|
| In[18]:= |
|
| Out[18]= |
|
| In[19]:= |
|
| Out[19]= |
|
Hyperedges can be of arbitrary arity:
| In[20]:= |
|
| Out[20]= |
|
By default, all hyperedges are treated as orderless (i.e. undirected):
| In[21]:= |
|
| Out[21]= |
|
| In[22]:= |
|
| Out[22]= |
|
Use "OrderedHyperedges"→True to treat hyperedges as ordered (i.e. directed):
| In[23]:= |
|
| Out[23]= |
|
| In[24]:= |
|
| Out[24]= |
|
By default, the vertex degrees along the main diagonal for an ordered (i.e. directed) hypergraph are given by the sum of vertex in- and out-degrees:
| In[25]:= |
|
| Out[25]= |
|
| In[26]:= |
|
| Out[26]= |
|
Use "OrderedHyperedgeDegree"→"InDegree" to use the vertex in-degree instead:
| In[27]:= |
|
| Out[27]= |
|
| In[28]:= |
|
| Out[28]= |
|
Use "OrderedHyperedgeDegree"→"OutDegree" to use the vertex out-degree instead:
| In[29]:= |
|
| Out[29]= |
|
| In[30]:= |
|
| Out[30]= |
|
This work is licensed under a Creative Commons Attribution 4.0 International License