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

Online Help

All Products    Maple    MapleSim


GraphTheory

  

HighlightSubgraph

  

highlight a subgraph of a graph

 

Calling Sequence

Parameters

Description

Examples

Compatibility

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

withGraphTheory:

GGraph1,2,1,3,2,3,3,4,4,5,4,6,5,6

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

(1)

HGraph1,2,3,4,1,2,1,3,2,3

HGraph 2: an undirected graph with 4 vertices and 3 edge(s)

(2)

G0HighlightSubgraphG,H,inplace=false

G0Graph 3: an undirected graph with 6 vertices and 7 edge(s)

(3)

DrawGraphG0

Here is an example of highlighting multiple subgraphs given as lists of vertices:

BBiconnectedComponentsG

B4,5,6,3,4,1,2,3

(4)

G1HighlightSubgraphG,B,Blue,Green,Cyan,Yellow,inplace=false

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

(5)

DrawGraphG1,style=spring

More detailed stylesheets can be used instead of just colors:

G2HighlightSubgraphG,B1,edgestylesheet=thickness=4,vertexstylesheet=thickness=4,color=White,inplace=false

G2Graph 5: an undirected graph with 6 vertices and 7 edge(s)

(6)

DrawGraphG2

Here a subgraph specified as a set of edges:

G3HighlightSubgraphG,1,2,1,3,2,3,inplace=false

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

(7)

DrawGraphG3

PSpecialGraphs:-PetersenGraph

PGraph 7: an undirected graph with 10 vertices and 15 edge(s)

(8)

HighlightSubgraphP,1,2,3,4,5,6,7,8,9,10,Blue,Green,White,Black

DrawGraphP

HighlightSubgraphP,1,2,3,4,5,6,7,8,9,10,edgestylesheet=thickness=4,color=Black,thickness=1,vertexstylesheet=color=White,color=Black,fontcolor=White

DrawGraphP

Compatibility

• 

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

• 

The stylesheet option was updated in Maple 2019.

See Also

DrawGraph

HighlightEdges

HighlightVertex

Subgraph