RulePlot can be used to get
a HypergraphPlot-based visual representation of hypergraph substitution rules:
In[] := RulePlot[WolframModel[{{1, 2}, {1, 2}} ->
{{3, 2}, {3, 2}, {2, 1}, {1, 3}}]]The shared elements between rule sides (vertices 1 and 2 in the example above) are put at the same positions in
the RulePlot and highlighted in a darker shade of blue. Shared edges are highlighted as well:
In[] := RulePlot[WolframModel[{{1, 2, 3}} -> {{1, 2, 3}, {3, 4, 5}}]]Multiple rules can be plotted:
In[] := RulePlot[WolframModel[{{{1, 1, 2}} ->
{{2, 2, 1}, {2, 3, 2}, {1, 2, 3}},
{{1, 2, 1}, {3, 4, 2}} -> {{4, 3, 2}}}]]Passing
a WolframModelEvolutionObject
plots its "Rules"
property:
Sometimes an incorrectly scaled layout might be produced due to the issue discussed above
in VertexCoordinates:
In[] := RulePlot[WolframModel[{{1, 2}, {1, 3}, {1, 4}} ->
{{2, 2}, {2, 2}, {2, 5}, {3, 2}}]]VertexCoordinates can be used in that case to specify the layout manually:
In[] := RulePlot[WolframModel[{{1, 2}, {1, 3}, {1, 4}} ->
{{2, 2}, {2, 2}, {2, 5}, {3, 2}}],
VertexCoordinates -> {1 -> {0, 0}, 2 -> {1, 0}, 3 -> {0, 1},
4 -> {-1, 0}, 5 -> {2, 1}}]Some of the HypergraphPlot options are supported,
specifically GraphHighlightStyle
, "HyperedgeRendering"
, VertexCoordinates, VertexLabels
, VertexSize, "ArrowheadLength",
and style options. "EdgeType" is supported as an option instead
of the second argument like in HypergraphPlot.
There are also two additional RulePlot-specific style options. Spacings controls the amount of empty space
between the rule parts and the frame (or the space where the frame would be if it's not shown):
In[] := RulePlot[WolframModel[{{{1, 2}} -> {{1, 3}, {1, 3}, {3, 2}},
{{1, 2}, {1, 2}} -> {{1, 3}, {3, 2}}}], Spacings -> 0.03]"RulePartsAspectRatio" is used to control the aspect ratio of rule sides. As an example, it can be used to force
rule parts to be square:
In[] := RulePlot[WolframModel[{{1, 2}} -> {{1, 3}, {1, 3}, {3, 2}}],
"RulePartsAspectRatio" -> 1]






