Draw - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Hypergraphs

  

Draw

  

Draw a hypergraph stored in the hypergraph data structure

 

Calling Sequence

Parameters

Description

Examples

References

Compatibility

Calling Sequence

Draw(H)

Draw(H, dopts, dgopts)

Parameters

H

-

Hypergraph

dopts

-

(optional) zero or more options specific to the Draw command, of the form vertexstylesheet=l, hyperedgestylesheet=l, smalledgestylesheet=l, bigedgestylesheet=l, output=o, or hyperedgelabels=f, where each l is a list, o is the name graph or plot or a list of these names, and f is a procedure generating hyperedge labels

dgopts

-

(optional) zero or more options to be passed to the GraphTheory:-DrawGraph command

Description

• 

The command Draw(H) displays the vertices and edges of the hypergraph H as the Maple plot of a graph G using the command DrawGraph  of the package GraphTheory.

• 

The graph G is constructed as follows.

– 

Each vertex of H is a vertex of G.

– 

Each hyperedge of H with at most 2 elements is an edge of G. We call these small hyperedges.

– 

For each hyperedge e of H with more than 2 elements, a new vertex v(e) is added to the vertex set of G, and for each x in e, there is an edge in G between x and v(e). We call these big hyperedges.

• 

The GraphTheory package can only deal with graphs whose vertices are integers, symbols (that is, variable names), or strings. Any vertices of H that are not of this type will be converted to strings. An error is raised if there are duplicates in the resulting vertex set.

Options

• 

The Draw command accepts several options. Any arguments not of a form listed below are passed to the GraphTheory:-DrawGraph command; its help page describes these options. By default, if G is connected, the option layout = spring is passed to GraphTheory:-DrawGraph, and no options at all if G is not connected. Note that any plot options can generally be passed to GraphTheory:-DrawGraph (and therefore to the Draw command), though not all such options are useful.

• 

vertexstylesheet = l

• 

This option gives a list of stylesheet options to be applied to the vertices of G that correspond to the vertices of H. The default value is [color = red].

• 

hyperedgestylesheet = l

• 

This option gives a list of stylesheet options to be applied to the vertices v(e) of G that correspond to big hyperedges of H. The default value is [shape = hexagon, fontsize = 6, fontcolor = "_match"]. This means that the labels of these vertices will not be visible; to make the labels visible, use this option and do not include the entry fontcolor = "_match".

• 

smalledgestylesheet = l

• 

This option gives a list of stylesheet options to be applied to the edges of G that correspond to small hyperedges of H. The default value is [] (no special styling).

• 

bigedgestylesheet = l

• 

This option gives a list of stylesheet options to be applied to the edges of G that correspond to big hyperedges of H. The default value is [linestyle = dash].

• 

output = o

• 

By default, the Draw command returns the plot data structure corresponding to the drawing of G by the GraphTheory:-DrawGraph command. For some applications, it may be useful to use G itself, rather than the plot data structure.

– 

If you use the option output = graph, the Draw command will return G.

– 

If you use the option output = plot (the default), the Draw command will return the plot data structure.

– 

If you use the option output = l, where l is a list of the names graph and plot, then the Draw command will return the corresponding values as an expression sequence. For example, if you use the option output = [plot, graph], then the Draw command will return an expression sequence P, G, where P is the plot data structure and G is the graph.

• 

hyperedgeslabels = f

• 

If you want to work with G, you may want to refer to its individual vertices, for example if you want to use the command GraphTheory:-StyleVertex. The vertices of G that correspond to vertices of H are the same as the vertices of H, so they can be referred to in the same way that you refer to the vertices of H. But the other vertices v(e) of G, corresponding to big hyperedges e of H, by default get a name that cannot be typed (each is a different local variable named the empty symbol).

• 

If you specify the hyperedgeslabel option, then f is a procedure or appliable module that is applied to each big hyperedge to obtain the label of the corresponding vertex of G. Each label should be an integer, a symbol (that is, a variable name), or a string. All such labels should be distinct, and they should be distinct from the vertices of H; otherwise, an error is raised.

• 

Note that these labels are generally not visible in the plot, because the default hyperedgestylesheet gives them a font color that matches the background color. Use the hyperedgestylesheet option if you want to see these labels in the plot.

Terminology

• 

Hypergraph : mathematically, a hypergraph is a pair (X, Y) where X  is a finite set and Y is a set of non-empty subsets of X.

• 

Vertices : the members of X are called the vertices of the hypergraph (X, Y).

• 

Hyperedges : the members of Y are called the hyperedges (or simply edges) of  the hypergraph (X, Y).

Examples

withHypergraphs:withExampleHypergraphs

Fan,Kuratowski,Lovasz,NonEmptyPowerSet,RandomHypergraph

(1)

Create a hypergraph for which every hyperedge has size 2.

HFan2

H< a hypergraph on 3 vertices with 3 hyperedges >

(2)

Print its vertices and edges.

VerticesH&semi;HyperedgesH

1&comma;2&comma;3

1&comma;2&comma;1&comma;3&comma;2&comma;3

(3)

Draw a graphical representation of this hypergraph.

DrawH

Construct another hypergraph with hyperedges of size 2 or 3.

KFan3

K< a hypergraph on 4 vertices with 4 hyperedges >

(4)

Print the vertices and edges of K.

VerticesK&semi;HyperedgesK

1&comma;2&comma;3&comma;4

1&comma;4&comma;2&comma;4&comma;3&comma;4&comma;1&comma;2&comma;3

(5)

Draw a graphical representation of K.

DrawK

Draw another graphical representation of K, but make the vertices of the hypergraph be blue, 8-pointed stars.

DrawK&comma;vertexstylesheet=shape=octagram&comma;color=blue

Draw another graphical representation of K with various changes to the stylesheets. Also specify that the labels for the vertices corresponding to big hyperedges should be the set represented as a string.

DrawK&comma;vertexstylesheet=fontstyle=bold&comma;hyperedgestylesheet=shape=wide rectangle&comma;padding=15&comma;fontsize=8&comma;smalledgestylesheet=thickness=2&comma;bigedgestylesheet=thickness=0&comma;color=gray&comma;`=`hyperedgelabels&comma;sconverts&comma;string

If we want more control over the visualization, for example, highlighting a particular edge or vertex in the resulting graph, we can obtain the graph data structure as follows.

f := proc(s :: set, $)
local stringlist := map(String, [op(s)]);
return StringTools:-Join(stringlist, "-");
end proc;

fprocs::set&comma; $localstringlist&semi;stringlistmapString&comma;ops&semi;returnStringTools:-Joinstringlist&comma;-end proc

(6)

GDrawK&comma;hyperedgelabels=f&comma;output=graph

GGraph 1: an undirected graph with 5 vertices and 6 edge(s)

(7)

We now color the edge between the vertex 1 of G (corresponding to the vertex 1 of H) and the vertex "1-2-3" of G (corresponding to the hyperedge {1, 2, 3} of H).

withGraphTheory&colon;

StyleEdgeG&comma;1&comma;1-2-3&comma;color=green

DrawGraphG

References

  

Claude Berge. Hypergraphes. Combinatoires des ensembles finis. 1987,  Paris, Gauthier-Villars, translated to English.

  

Claude Berge. Hypergraphs. Combinatorics of Finite Sets.  1989, Amsterdam, North-Holland Mathematical Library, Elsevier, translated from French.

  

Charles Leiserson, Liyun Li, Marc Moreno Maza and Yuzhen Xie " Parallel computation of the minimal elements of a poset." Proceedings of the 4th International Workshop on Parallel Symbolic Computation (PASCO) 2010: 53-62, ACM.

Compatibility

• 

The Hypergraphs[Draw] command was introduced in Maple 2024.

• 

For more information on Maple 2024 changes, see Updates in Maple 2024.

See Also

Hypergraphs[Hyperedges]

Hypergraphs[Hypergraph]

Hypergraphs[Vertices]

GraphTheory[DrawGraph]