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
WolframInstitute`Hypergraph`
ToLabeledEdges
​
ToLabeledEdges
[vertexLabels,edges]
pairs every vertex occurring in the list of hyperedges edges with its label from the association vertexLabels, giving
Labeled
[vertex,label]
in its place.
​
​
ToLabeledEdges
[vertexLabels,edges,
True
]
instead turns edges into a pattern: every vertex becomes a fresh pattern variable wrapped as
Labeled
[_,label_]
, so label captures whatever value occupies that vertex's position when the pattern is matched.
​
​
ToLabeledEdges
[hg]
and
ToLabeledEdges
[hg,
True
]
give the same two forms directly from a
Hypergraph
hg, using its
VertexLabels
annotation as vertexLabels.
​
Details and Options
▪
Two vertices given the same label symbol become the same pattern variable in the result, so ordinary Wolfram Language pattern matching already forces them to bind to equal values; two vertices given different label symbols instead get an explicit condition requiring their captured values to differ. This is the mechanism behind
HypergraphRule
's
"DistinctVertexLabels"
option.
▪
The optional third argument (the pattern form's vertexCondition, default
True
) can be set to
False
to omit that distinctness condition and allow differently labeled vertices to capture the same value.
▪
ToLabeledEdges
[hg,…]
additionally accepts an edgeCondition argument (default
False
) analogous to vertexCondition, but for distinctness among the hyperedges' own labels.
▪
ToLabeledEdges
is the internal representation
HypergraphRuleApply
(used by
rule[hg]
, see
HypergraphRule
) builds from a hypergraph before handing it, and a pattern built the same way, to
ResourceFunction["MultiReplace"]
;
ToLabeledPatternEdges
is a convenience wrapper around the pattern form that additionally accounts for a hyperedge's own symmetry.
​
Examples  
(5)
Basic Examples  
(3)
Pair each vertex of a hyperedge with its label:
In[1]:=
ToLabeledEdges
[1"p",2"q",{{1,2}}]
Out[1]=

1
p
,
2
q

_________________________________________________________________________________________________________________
Building the pattern form instead, two vertices with different label symbols require their captured values to differ:
In[1]:=
​​MatchQ{{Labeled[10,"p"],Labeled[20,"q"]}},
ToLabeledEdges
[1x,2y,{{1,2}},True],​​MatchQ{{Labeled[10,"p"],Labeled[20,"p"]}},
ToLabeledEdges
[1x,2y,{{1,2}},True]​​
Out[1]=
{True,False}
_________________________________________________________________________________________________________________
Giving both vertices the same label symbol instead requires their captured values to coincide:
In[1]:=
​​MatchQ{{Labeled[10,"p"],Labeled[20,"p"]}},
ToLabeledEdges
[1x,2x,{{1,2}},True],​​MatchQ{{Labeled[10,"p"],Labeled[20,"q"]}},
ToLabeledEdges
[1x,2x,{{1,2}},True]​​
Out[1]=
{True,False}
Scope  
(2)

SeeAlso
ToLabeledPatternEdges
 
▪
ToPatternRules
 
▪
HypergraphRule
 
▪
HighlightRule
RelatedGuides
▪
HypergraphFunctionality
""

© 2026 Wolfram. All rights reserved.

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