|
Calling Sequence
|
|
DrawGraph(G, options)
DrawGraph(L, options)
|
|
Parameters
|
|
G
|
-
|
graph
|
L
|
-
|
list or set of graphs
|
options
|
-
|
(optional) one or more options as specified below
|
|
|
|
|
Options
|
|
|
The options argument can contain one or more of the options shown below. In addition, DrawGraph accepts those options listed on plot,options for 2-D visualizations and those options listed on plot3d,option for 3-D visualizations.
|
•
|
animate = truefalse, posint
|
|
If the layout=spring or layout=spring[constant] option is specified then animate=true generates a 50 frame animation of the model. If animate=a positive integer then an animation with the specified number of frames is generated. The default is false.
|
|
The number of dimensions in the generated plot.
|
|
If the layout=spring or layout=spring[constant] option is specified then redraw=true causes the graph to be redrawn using a different random starting position. The default is false.
|
|
If the layout=tree drawing option is specified then G must be undirected or an arborescence per IsArborescence. If G is undirected and not a tree, its SpanningTree is used to determine the location of its vertices, but all of the edges of G are drawn. The additional optional argument root=v can be specified to specify the root vertex v. The value v must be a vertex in G.
|
|
The display of vertex labels can be forced or suppressed with the option showlabels=true and showlabels=false, respectively. By default, the vertex labels are displayed when G has fewer than 100 vertices.
|
•
|
showweights = truefalse
|
|
The display of edge weights can be forced or suppressed with the option showweights=true and showweights=false, respectively. By default, the edge weights are displayed when G is a weighted graph with fewer than 46 edges.
|
•
|
layout = default, none, bipartite, circle, planar, spectral, spring, spring[constant], or tree.
|
|
In previous versions, this option was named style but it was renamed to distinguish it from the stylesheet option. The option name style is still supported.
|
|
The layout option directs DrawGraph to display the input graph in a specific layout style. There are many different layout styles supported for displaying a graph such as bipartite, circle, planar, spectral, spring, and tree. A complete list with more details on each type of layout can be found in GraphLayouts.
|
|
When layout is default, then the components of a disconnected graph are detected and are displayed separately. The type of each graph or a component of a disconnected graph is distinguished and is displayed accordingly.
|
|
Some graph layout options can be controlled in more detail with additional options. More details can be found in GraphLayouts.
|
|
Animations and 3-D graph renderings also support the stylesheet option except that 3-D visualizations ignore any vertex shape specification.
|
|
Specifying stylesheet="legacy" displays the graph with the default settings for Maple 2016 and previous versions.
|
|
|
Description
|
|
•
|
DrawGraph displays the vertices and edges of a graph G as a Maple plot. If G has fewer than 100 vertices, the vertex labels are also displayed. If G is a weighted graph with fewer than 46 edges then the edge weights are displayed.
|
•
|
By default, the vertex positions for paths, cycles, cliques and most of the graphs in the SpecialGraphs, such as the Petersen graph, have been predefined, so that when displayed, they appear as they would in a textbook. You can specify the vertex positions for the display of a graph using the SetVertexPositions command.
|
•
|
If G is a set or list of graphs, then the graphs are displayed in a Matrix format, where any leftover cells are simply displayed as empty. The number of graphs to display horizontally is chosen as a value between 2 and 4 determined by the number of graphs in the input list. This can be overridden by providing the width option to tell DrawGraph the number of graphs to display horizontally. For example, specify width=1 to display the graphs in one long vertical band, and specify width=nops(G) to display the graphs in one wide horizontal band.
|
|
|
Examples
|
|
>
|
|
>
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
>
|
|
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
| (7) |
>
|
|
>
|
|
| (8) |
>
|
|
>
|
|
To play the following animation in this help page, right-click (Control-click, on Macintosh) the plot to display the context menu. Select Animation > Play.
>
|
|
The commands to create the plots from the Plotting Guide are
| (9) |
>
|
|
>
|
|
| (11) |
>
|
|
| (12) |
| (13) |
>
|
|
|
|
Compatibility
|
|
•
|
The stylesheet option was introduced in Maple 2017.
|
•
|
The GraphTheory[DrawGraph] command was updated in Maple 2020.
|
•
|
The layout and layoutoptions options were introduced in Maple 2020.
|
•
|
The animate and stylesheet options were updated in Maple 2020.
|
|
|
|