HighlightVertex - Maple Help

GraphTheory

 HighlightVertex
 highlight a vertex of a graph

 Calling Sequence HighlightVertex(G, V) HighlightVertex(G, V, C, ip) HighlightVertex(G, V, stylesheet=[ optionsequence ], ip )

Parameters

 G - graph V - a single vertex or a list, set, or Array of vertices of G C - (optional) color or list of colors ip - (optional) equation of the form inplace = true or inplace = false stylesheet - (optional) optionsequence is a sequence of keyword options to specify the style or a list of such sequences.

Description

 • By default the DrawGraph command draws the edges and vertices of the graph with the same set of style options. HighlightVertex allows you to specify vertices to be given a different highlighted style specified in the graph stylesheet.
 • Given only a graph G and a vertex or vertices V, HighlightVertex marks the specified vertices to be rendered with the default highlighted style.
 • If you simply want a vertex to have a different style without being grouped with other highlighted graph components, use the command StyleVertex instead.
 • If you want to highlight a vertex but give it a different color, the simplest way it to just specify C, the 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 overriding of the default highlighted style can be set using stylesheet options. The stylesheet options are understood as modifiers to the default highlighted style. So, for example, if a color is not specified, the default highlighted color is used. If the stylesheet option and a color C are both given, the color C is ignored.  See StyleVertex for a complete list of vertex style options.

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)

The default highlighted style

 > $\mathrm{HighlightVertex}\left(\mathrm{K5},1\right)$
 > $\mathrm{DrawGraph}\left(\mathrm{K5}\right)$

Highlight using a custom color

 > $\mathrm{HighlightVertex}\left(\mathrm{K5},\left\{1,3\right\},"DodgerBlue"\right)$
 > $\mathrm{DrawGraph}\left(\mathrm{K5}\right)$

Highlighting vertices a second time does not merge styles but overwrites them.

 > $\mathrm{HighlightVertex}\left(\mathrm{K5},\left\{1,3\right\},\mathrm{stylesheet}=\left[\mathrm{font}=\left["Courier","bold",14\right],\mathrm{thickness}=3\right]\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{HighlightVertex}\left(G,A,\mathrm{stylesheet}=\left[\mathrm{color}="Magenta",\mathrm{border}=\mathrm{false},\mathrm{fontstyle}="bold"\right],\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)$
 > $\mathrm{HighlightVertex}\left(G,\left[1,5\right],\left["Fill Spring Blue","Fill Spring Yellow"\right]\right)$
 > $\mathrm{DrawGraph}\left(G\right)$
 > $\mathrm{HighlightVertex}\left(G,\left[2,3\right],\mathrm{stylesheet}=\left[\left[\mathrm{fontstyle}="italic"\right],\left[\mathrm{fontstyle}="bold"\right]\right]\right)$
 > $\mathrm{DrawGraph}\left(G\right)$

Compatibility

 • The GraphTheory[HighlightVertex] command was updated in Maple 2019.
 • The stylesheet option was updated in Maple 2019.