GraphTheory
GetVertexPositions
get positions of graph vertices
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
GetVertexPositions(G, opts)
G
-
graph
opts
(optional) one or more options as specified below
dimension=2 or 3
The number of dimensions in the layout to return. The default is 2.
layout=default, bipartite, circle, fixed, grid, network, planar, random, spectral, spring, tree, or user.
The layout option directs GetVertexPositions to return a previously computed layout with the specified layout method. The name style is a synonym for this option.
If no layout method is specified, the vertex positions corresponding to the default drawing style of the graph are returned.
output=list or Matrix
Specifies whether the points should be output as a list of lists or as a Matrix. The default is list.
The GetVertexPositions('G', 'opts') command returns a list of coordinates representing the positions of the vertices in a previously computed layout.
If a layout is specified with the layout option and this layout was not previously computed, the empty list is returned.
with⁡GraphTheory:
with⁡SpecialGraphs:
vp≔GetVertexPositions⁡CycleGraph⁡9
vp≔6.1232340×10−17,1.,0.64278761,0.76604444,0.98480775,0.17364818,0.86602540,−0.50000000,0.34202014,−0.93969262,−0.34202014,−0.93969262,−0.86602540,−0.50000000,−0.98480775,0.17364818,−0.64278761,0.76604444
G≔Graph⁡Trail⁡0,1,2,3,4,5,6,7,8,9,1,Trail⁡4,0,7
G≔Graph 1: an undirected graph with 10 vertices and 12 edge(s)
SetVertexPositions⁡G,0,0,op⁡vp:
DrawGraph⁡G
We will disguise the Petersen graph by drawing it using the spring option and make those vertex positions the default.
P≔PetersenGraph⁡
P≔Graph 2: an undirected graph with 10 vertices and 15 edge(s)
DrawGraph⁡P,layout=spring
S≔GetVertexPositions⁡P,layout=spring
S≔0.966139924305212,0.124423409473989,0.671492362648830,−0.622945284595226,0.0883553749810576,−0.911677655976657,−0.684646177755365,−0.692940942250190,0.0914644149940569,−0.184725679296864,0.285604708677752,1.,0.364102368397874,0.407906501760275,−0.268943385452634,0.543170254501320,−0.545132908598927,−0.0422890152843517,−0.968436682197856,0.379078411667707
Q≔CopyGraph⁡P
Q≔Graph 3: an undirected graph with 10 vertices and 15 edge(s)
SetVertexPositions⁡Q,S
DrawGraph⁡Q
The GraphTheory[GetVertexPositions] command was updated in Maple 2020.
The dimension, layout and output options were introduced in Maple 2020.
For more information on Maple 2020 changes, see Updates in Maple 2020.
See Also
DrawGraph
SetVertexPositions
Trail
Download Help Document