 StyleVertex - Maple Help

GraphTheory

 StyleVertex
 specify style changes to highlight certain vertices of a graph Calling Sequence StyleVertex(G, V) StyleVertex(G, V, style, ip) Parameters

 G - graph V - a single vertex or a list, set, or Array of vertices of G ip - (optional) equation of the form inplace = true or inplace = false style - (optional) a sequence of keyword options a table or a string to specify the style or a list of these to specify multiple styles. Description

 • By default the DrawGraph command draws the edges and vertices of the graph with the same set of style options. The command StyleVertex, allows you to specify individual styles for specified vertices overriding the default or a previously set style.
 • Given only a graph G and a vertex or vertices V, StyleVertex marks the specified vertices to be rendered with the default highlight style.
 • The simplest way to customize the rendering is to give C, a color for the vertex. The colors C can be given in any form understood by Maple. See ColorTools/Formats for details. When the color of the vertex is set the color of the vertex label is set automatically to an appropriately contrasting grayscale.
 • If V is a list or Array of vertices then a list of colors or stylesheets is used to associate a different color or style to each member.
 • 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.
 • More precise control of the style can be set using stylesheet options. The stylesheet options are understood as modifiers to the default highlight style. So, for example, if a color is not specified the default highlight color is used. If the stylesheet option and a color C are both given, the color C is ignored. 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

 > $\mathrm{with}\left(\mathrm{GraphTheory}\right):$
 > $\mathrm{K5}≔\mathrm{CompleteGraph}\left(5\right)$
 ${\mathrm{K5}}{≔}{\mathrm{Graph 1: an undirected unweighted graph with 5 vertices and 10 edge\left(s\right)}}$ (1)
 > $\mathrm{StyleVertex}\left(\mathrm{K5},1,\mathrm{color}="Red"\right)$
 > $\mathrm{DrawGraph}\left(\mathrm{K5}\right)$ Style multiple vertices with one color

 > $\mathrm{StyleVertex}\left(\mathrm{K5},\left\{1,3\right\},\mathrm{color}="DodgerBlue"\right)$
 > $\mathrm{DrawGraph}\left(\mathrm{K5}\right)$ Styling vertices a second time adds to or replaces the existing style

 > $\mathrm{StyleVertex}\left(\mathrm{K5},\left\{1,3\right\},\mathrm{font}=\left["Courier","bold",14\right],\mathrm{thickness}=3\right)$
 > $\mathrm{DrawGraph}\left(\mathrm{K5}\right)$ > $G≔\mathrm{Graph}\left(\left\{\left\{1,2\right\},\left\{1,3\right\},\left\{2,3\right\},\left\{3,4\right\},\left\{4,5\right\},\left\{4,6\right\},\left\{5,6\right\}\right\}\right)$
 ${G}{≔}{\mathrm{Graph 2: an undirected unweighted graph with 6 vertices and 7 edge\left(s\right)}}$ (2)
 > $A≔\mathrm{ArticulationPoints}\left(G\right)$
 ${A}{≔}\left[{3}{,}{4}\right]$ (3)
 > $H≔\mathrm{StyleVertex}\left(G,A,\mathrm{color}="Magenta",\mathrm{border}=\mathrm{false},\mathrm{fontstyle}="bold",\mathrm{inplace}=\mathrm{false}\right)$
 ${H}{≔}{\mathrm{Graph 3: an undirected unweighted graph with 6 vertices and 7 edge\left(s\right)}}$ (4)
 > $\mathrm{DrawGraph}\left(H\right)$ G was unchanged

 > $\mathrm{DrawGraph}\left(G\right)$ Style multiple vertices different colors

 > $\mathrm{StyleVertex}\left(G,\left[1,5\right],\left[\mathrm{color}="Fill Spring Blue"\right],\left[\mathrm{color}="Fill Spring Yellow"\right]\right)$
 > $\mathrm{DrawGraph}\left(G\right)$ > $\mathrm{StyleVertex}\left(G,\left[2,3\right],\left[\left[\mathrm{fontstyle}="italic"\right],\left[\mathrm{fontstyle}="bold"\right]\right]\right)$
 > $\mathrm{DrawGraph}\left(G\right)$  Compatibility

 • The GraphTheory[StyleVertex] command was introduced in Maple 2020.
 • For more information on Maple 2020 changes, see Updates in Maple 2020.