Wolfram Language Paclet Repository

Community-contributed installable additions to the Wolfram Language

Primary Navigation

    • Cloud & Deployment
    • Core Language & Structure
    • Data Manipulation & Analysis
    • Engineering Data & Computation
    • External Interfaces & Connections
    • Financial Data & Computation
    • Geographic Data & Computation
    • Geometry
    • Graphs & Networks
    • Higher Mathematical Computation
    • Images
    • Knowledge Representation & Natural Language
    • Machine Learning
    • Notebook Documents & Presentation
    • Scientific and Medical Data & Computation
    • Social, Cultural & Linguistic Data
    • Strings & Text
    • Symbolic & Numeric Computation
    • System Operation & Setup
    • Time-Related Computation
    • User Interface Construction
    • Visualization & Graphics
    • Random Paclet
    • Alphabetical List
  • Using Paclets
    • Get Started
    • Download Definition Notebook
  • Learn More about Wolfram Language

Hypergraph

Guides

  • Hypergraph Functionality

Tech Notes

  • Hypergraph Rewriting

Symbols

  • AdjacencyHypergraph
  • AdjacencyTensor
  • CanonicalHypergraph
  • CanonicalHypergraphRule
  • ConnectedHypergraphQ
  • CyclicEdge
  • EdgeListTagged
  • EdgeMultiplicity
  • EdgeSymmetry
  • EnumerateHypergraphRules
  • EnumerateHypergraphs
  • EnumerateOrderedHypergraphs
  • EnumerateWolframModelRules
  • HighlightRule
  • HyperedgeList
  • Hyperedge
  • Hyperedges
  • HyperedgesQ
  • Hypergraph3D
  • HypergraphArityReduce
  • HypergraphDraw
  • HypergraphEmbedding
  • HypergraphHadamardProduct
  • HypergraphIncidenceMatrix
  • HypergraphIncidence
  • HypergraphInsertionBracketDegree
  • HypergraphInsertionBracket
  • HypergraphInsertion
  • HypergraphLargeQ
  • Hypergraph
  • HypergraphQ
  • HypergraphRuleDraw
  • HypergraphRule
  • HypergraphRuleQ
  • HypergraphToGraph
  • HypergraphTransitionMatrix
  • HypergraphUnion
  • HypermatrixGraph
  • Hypermatrix
  • HypermatrixQ
  • IncidenceHypergraph
  • IsomorphicHypergraphQ
  • KoszulSign
  • LinkedHypergraph
  • OrderedHypergraphToGraph
  • RandomAllHypergraph
  • RandomConnectedHypergraph
  • RandomHypergraph
  • RandomHypergraphRule
  • SetHypergraphSummaryThresholds
  • SimpleHypergraph
  • SimpleHypergraphPlot3D
  • SimpleHypergraphPlot
  • SimpleHypergraphQ
  • ToLabeledEdges
  • ToLabeledPatternEdges
  • ToOrderedHypergraph
  • ToPatternRules
Hypergraph Rewriting
Hypergraph rewriting repeatedly transforms a hypergraph by replacing subhypergraphs that match the left-hand side of a rule with the right-hand side of the rule. Systems of this kind, known as Wolfram models, are studied as models of fundamental physics, and the Hypergraph paclet provides the objects to build, apply, visualize and enumerate such rules.
Rewriting Rules
A
HypergraphRule
consists of an input
Hypergraph
to match and an output
Hypergraph
to substitute:
In[1]:=
rule=
HypergraphRule

Hypergraph
[{{1,2}}],
Hypergraph
[{{1,2},{2,3}}]
Out[1]=
The rule displays as a diagram of its input and output sides. Both sides are ordinary
Hypergraph
objects with all their styling and symmetry options:
In[2]:=
rule["Output"]
Out[2]=
Applying a Rule
Applying a rule to a hypergraph gives one record for every way its input matches:
In[3]:=
matches=
HypergraphRule

Hypergraph
[{{1,2}}],
Hypergraph
[{{1,2},{2,3}}]
Hypergraph
[{{a,b},{b,c}}];​​Length[matches]
Out[3]=
4
Each record is an association describing one rewrite:
In[4]:=
Keys[First[matches]]
Out[4]=
{Hypergraph,MatchVertices,MatchEdges,MatchEdgePositions,NewVertices,NewEdges,DeletedVertices,RuleVertexMap,Bindings,EdgeArities}
The "Hypergraph" key holds the rewritten hypergraph; newly created vertices get fresh names:
In[5]:=
First[matches]["Hypergraph"]
Out[5]=
Edge Symmetry and Matching
The number of matches depends on the edge symmetry of the hypergraph and the rule. By default hyperedges are unordered, so a single binary pattern edge matches each binary edge in both orientations. With "Ordered" symmetry each edge matches only one way:
In[6]:=
orderedRule=
HypergraphRule
​​
Hypergraph
[{{1,2}},"EdgeSymmetry""Ordered"],​​
Hypergraph
[{{1,2},{2,3}},"EdgeSymmetry""Ordered"];​​LengthorderedRule
Hypergraph
[{{a,b},{b,c}},"EdgeSymmetry""Ordered"]
Out[6]=
2
The rewritten hypergraphs of all ordered matches:
In[7]:=
#["Hypergraph"]&/@orderedRule
Hypergraph
[{{a,b},{b,c}},"EdgeSymmetry""Ordered"]
Out[7]=

,

Visualizing Matches
HighlightRule
renders every match of a rule inside a hypergraph, highlighting the matched edges and the produced edges:
In[8]:=
HighlightRule
​​
HypergraphRule
​​
Hypergraph
[{{1,2}},"EdgeSymmetry""Ordered"],​​
Hypergraph
[{{1,2},{2,3}},"EdgeSymmetry""Ordered"],​​
Hypergraph
[{{a,b},{b,c}},"EdgeSymmetry""Ordered"]
Out[8]=

,

Evolution
Iterating a rule produces an evolution of hypergraph states. Here each step applies the first available match:
The edge counts grow by one at each step:
Applying all matches simultaneously, or exploring every match branch separately, leads to multiway evolution; the per-match records returned by rule application carry enough information ("MatchEdgePositions", "NewEdges", "DeletedVertices") to build either.
Enumerating and Sampling Rules
A small sample of the enumerated rules:

© 2026 Wolfram. All rights reserved.

  • Legal & Privacy Policy
  • Contact Us
  • WolframAlpha.com
  • WolframCloud.com