 HighlightSubgraph - Maple Help

GraphTheory

 HighlightSubgraph
 highlight a subgraph of a graph Calling Sequence HighlightSubgraph(G, S) HighlightSubgraph(G, S, C1, C2, ip) HighlightSubgraph(G, S, edgestylesheet=[ optionsequence ], vertexstylesheet=[ optionsequence ], ip) Parameters

 G - graph S - a subgraph or a list or set of subgraphs of G C1, C2 - (optional) colors for edges and vertices respectively ip - (optional) equation of the form inplace = true or inplace = false edgestylesheet - (optional) optionsequence is a sequence of keyword options to specify the style or a list of such sequences vertexstylesheet - (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. The command HighlightVertex, allows the subgraph to be given a different highlighted style specified in the graph stylesheet.
 • A subgraph can be given explicitly as a graph or implicitly as a list/set of vertices of G, or a list/set of edges of G.  In the implicit cases, explicit subgraphs will be constructed using the Subgraph command for edges or the InducedSubgraph command for vertices.
 • Given only a graph G and a subgraph or subgraphs S, HighlightSubgraph marks the components of the specified subgraphs as to be rendered with the default highlighted style.
 • If you simply want a trail to have a different style without being grouped with other highlighted graph components, use the command StyleSubgraph instead.
 • If you want to highlight a subgraph but give it different colors, the simplest way is to give C1, a color for the edges, and C2, a color for the vertices. The colors can be given in any form understood by Maple. See ColorTools/Formats for details. When the color of a vertex is set, the color of the vertex label is set automatically to an appropriately contrasting grayscale.
 • If S is a list of subgraphs, then a list of colors or stylesheets can be 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 highlight color is used. If the stylesheet options and a color C1 or C2 are both given, the colors are ignored. See StyleSubgraph for a complete list of vertex and edge style options. Examples

 > $\mathrm{with}\left(\mathrm{GraphTheory}\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 1: an undirected unweighted graph with 6 vertices and 7 edge\left(s\right)}}$ (1)
 > $H≔\mathrm{Graph}\left(\left[1,2,3,4\right],\left\{\left\{1,2\right\},\left\{1,3\right\},\left\{2,3\right\}\right\}\right)$
 ${H}{≔}{\mathrm{Graph 2: an undirected unweighted graph with 4 vertices and 3 edge\left(s\right)}}$ (2)
 > $\mathrm{G0}≔\mathrm{HighlightSubgraph}\left(G,H,\mathrm{inplace}=\mathrm{false}\right)$
 ${\mathrm{G0}}{≔}{\mathrm{Graph 3: an undirected unweighted graph with 6 vertices and 7 edge\left(s\right)}}$ (3)
 > $\mathrm{DrawGraph}\left(\mathrm{G0}\right)$ Here is an example of highlighting multiple subgraphs given as lists of vertices:

 > $B≔\mathrm{BiconnectedComponents}\left(G\right)$
 ${B}{≔}\left[\left[{4}{,}{5}{,}{6}\right]{,}\left[{3}{,}{4}\right]{,}\left[{1}{,}{2}{,}{3}\right]\right]$ (4)
 > $\mathrm{G1}≔\mathrm{HighlightSubgraph}\left(G,B,\left["Blue","Green","Cyan"\right],"Yellow",\mathrm{inplace}=\mathrm{false}\right)$
 ${\mathrm{G1}}{≔}{\mathrm{Graph 4: an undirected unweighted graph with 6 vertices and 7 edge\left(s\right)}}$ (5)
 > $\mathrm{DrawGraph}\left(\mathrm{G1},\mathrm{style}=\mathrm{spring}\right)$ More detailed stylesheets can be used instead of just colors:

 > $\mathrm{G2}≔\mathrm{HighlightSubgraph}\left(G,B\left[1\right],\mathrm{edgestylesheet}=\left[\mathrm{thickness}=4\right],\mathrm{vertexstylesheet}=\left[\mathrm{thickness}=4,\mathrm{color}="White"\right],\mathrm{inplace}=\mathrm{false}\right)$
 ${\mathrm{G2}}{≔}{\mathrm{Graph 5: an undirected unweighted graph with 6 vertices and 7 edge\left(s\right)}}$ (6)
 > $\mathrm{DrawGraph}\left(\mathrm{G2}\right)$ Here a subgraph specified as a set of edges:

 > $\mathrm{G3}≔\mathrm{HighlightSubgraph}\left(G,\left\{\left\{1,2\right\},\left\{1,3\right\},\left\{2,3\right\}\right\},\mathrm{inplace}=\mathrm{false}\right)$
 ${\mathrm{G3}}{≔}{\mathrm{Graph 6: an undirected unweighted graph with 6 vertices and 7 edge\left(s\right)}}$ (7)
 > $\mathrm{DrawGraph}\left(\mathrm{G3}\right)$ > $P≔\mathrm{SpecialGraphs}:-\mathrm{PetersenGraph}\left(\right)$
 ${P}{≔}{\mathrm{Graph 7: an undirected unweighted graph with 10 vertices and 15 edge\left(s\right)}}$ (8)
 > $\mathrm{HighlightSubgraph}\left(P,\left[\left[1,2,3,4,5\right],\left[6,7,8,9,10\right]\right],\left["Blue","Green"\right],\left["White","Black"\right]\right)$
 > $\mathrm{DrawGraph}\left(P\right)$ > $\mathrm{HighlightSubgraph}\left(P,\left[\left[1,2,3,4,5\right],\left[6,7,8,9,10\right]\right],\mathrm{edgestylesheet}=\left[\left[\mathrm{thickness}=4,\mathrm{color}="Black"\right],\left[\mathrm{thickness}=1\right]\right],\mathrm{vertexstylesheet}=\left[\left[\mathrm{color}="White"\right],\left[\mathrm{color}="Black",\mathrm{fontcolor}="White"\right]\right]\right)$
 > $\mathrm{DrawGraph}\left(P\right)$  Compatibility

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