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

Online Help

All Products    Maple    MapleSim


GraphTheory

  

StyleVerticesByProperty

  

style graph vertices by property

 

Calling Sequence

Parameters

Options

Description

Examples

Compatibility

Calling Sequence

StyleVerticesByProperty(G, P, ip)

Parameters

G

-

graph

P

-

either a list of numeric values, one for each vertex of G, or a procedure that returns a list of numeric values, one for each vertex of G

ip

-

(optional) equation of the form inplace = true or inplace = false

Options

• 

colorscheme : colors

  

This sets vertexcolor using ColorTools:-Blend.

• 

fontcolorscheme : colors

  

This sets vertexfontcolor using ColorTools:-Blend.

• 

fontsizescheme : posint

  

This sets vertexfontsize. The values given must be valid font sizes in points.

• 

paddingscheme : nonnegative

  

This sets vertexpadding. The values are given in points.

• 

shapescheme : string

  

This sets vertexshape. The values are given as strings. Only valuesplit schemes are supported.

• 

scheme : list_of_styles

  

This only supports valuesplit schemes.  For each value a custom list of stylesheet properties can be given.

• 

range=range(numeric)

• 

All styling schemes scale the values in P to the range 0..1 based on the minimum and maximum values in P.  The range option overrides that and does a linear scaling where lhs(range) becomes to 0 and rhs(range) becomes 1.  This is useful for achieving consistent styling across multiple graphs.  After scaling, values less than 0 will be treated the same as 0 and values greater than 1 will be treated the same as 1.

• 

markers=list(numeric)

• 

By default all the styling schemes linearly interpolate between styles equally spaced across on interval. The markers option allows you to specify exactly which values between 0 and 1 are assigned to each style.  The value of markers must be a sorted list of values between 0 and 1 which is the same length as the list of values given to each scheme.

  

Limitation: If multiple style schemes are being used with markers, all the schemes must have the same number of values. The best work around is to just invoke this command twice on the same graph.

Description

• 

By default the DrawGraph command draws the edges and vertices of the graph with the same set of style options. The command StyleVerticesByProperty allows you to set styles for all vertices according to a property.  If no style is specified, the default of colorscheme=["Blue", "White", "Red"] will be used.

• 

Every style scheme can also be given as a valuesplit scheme. Instead of a list of values to blend between, a valuesplit scheme assigns a discrete set of styles by exact value, range, or list or set of values given as a list of equations and default value. The equations match the property value to the left-hand side and use the value on the right-hand side. For example, colorscheme=["valuesplit", [1="Blue", 2..3="Red", [4,5]="Green", "DarkGrey"] ] If no default value is given, unmatched properties will not be given a style.

• 

By default, this command modifies G and returns nothing. If you supply the option inplace = false, then instead the changes are applied to a copy of G, and that copy is returned.

Vertex Stylesheet Options

• 

The styles that are understood for vertices are:

– 

border : whether to draw the border (true or false), or a color. Special color values are supported.

• 

Special value "_contrast" (the default color) automatically sets the line color to a grayscale value that contrasts with the vertex color.

• 

Special value "_blend" sets the line color to the average of the colors of the vertex and the plot background.

• 

Special value "_match" sets the font color to the vertex color and the vertex is drawn in the background color. It also supports all the other formats in ColorTools/Format.

– 

color : color of the vertex. See ColorTools/Format.

– 

fontcolor : color of the vertex label. Special color values are supported.

• 

Special value "_contrast" (the default color) automatically sets the font to a grayscale value that contrasts with the vertex color.

• 

Special value "_match" sets the font color to the vertex color.

• 

Special value "_blend" also sets the font color to the vertex color. It also supports all the other formats in ColorTools/Format.

– 

fontsize : size of the vertex label, a positive integer in points

– 

fontfamily : font family to use for the vertex label, a string. See plot/options.

– 

fontstyle : font style to use for the vertex label, a string. See plot/options.

– 

font : shorthand to specify a vertex label font as a list either [family, size] or [family, style, size]

– 

padding : extra space around vertex label, a number in points

– 

shape : shape of the vertex, a string understood by plottools/polygonbyname or default.  Examples:

• 

ellipse, circle,

• 

common polygons up to ten sides, e.g., hexagon

• 

arbitrary regular polygons given as number-gon, e.g., 7gon

• 

a regular star version of polygons with more than 4 sides will be drawn if prefixed (with or without spaces) with star, e.g., star hexagon

• 

a flattened version of a polygon will be drawn if prefixed with wide, e.g., wide pentagon

• 

the wide and star prefixes can be combined in any order

• 

polygons are drawn with a flat bottom unless prefixed with inverted in which case it will have point bottom, e.g., inverted 9gon

• 

the inverted, star, and wide prefixes can be combined, but inverted must come first, though it can be abbreviated to inv, e.g., invwide13gon

– 

thickness : thickness of the border, a non-negative value

Examples

withGraphTheory:

G1Graph1,2,1,3,2,3,3,4,4,5,4,6,5,6

G1Graph 1: an undirected graph with 6 vertices and 7 edge(s)

(1)

StyleVerticesByPropertyG1,Degree,colorscheme=Blue,White,Red,range=0..5

DrawGraphG1

G2RandomGraphs:-RandomGraph10,15,connected

G2Graph 2: an undirected graph with 10 vertices and 15 edge(s)

(2)

StyleVerticesByPropertyG2,BetweennessCentrality,fontsizescheme=8,16,colorscheme=Blue,White,Red

DrawGraphG2,layout=spring,stylesheet=vertexshape=star

G3SpecialGraphs:-FlowerSnark5

G3Graph 3: an undirected graph with 20 vertices and 30 edge(s)

(3)

CircularChromaticNumberG3,coloring

52

(4)

StyleVerticesByPropertyG3,coloring,colorscheme=valuesplit,seqi=catSpring ,i+1,iinconvertcoloring,set

DrawGraphG3

Compatibility

• 

The GraphTheory[StyleVerticesByProperty] command was introduced in Maple 2020.

• 

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

See Also

DrawGraph

StyleEdge

StyleSubgraph

Vertices

 


Download Help Document