GraphTheory - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : GraphTheory/HighlightSubgraph

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 you to specify individual styles for specified vertices overriding the default or a previously set style.

• 

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 highlight style.

• 

The simplest way to customize the rendering 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 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 options and a color C1 or C2 are both given, the colors is ignored.

Vertex Stylesheet Options

• 

The styles that are understood for vertices are:

– 

border : whether to draw the border, true or false

– 

color : color of the vertex. See ColorTools/Format

– 

fontcolor : color of the vertex label. See 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 nonnegative value

Edge Stylesheet Options

• 

The styles that are understood for edges are:

– 

arrowpos : the position of the arrow on a directed edge, a number between 0 and 1

– 

arrowsize : the length, in points, of the arrow on a directed edge, a positive number

– 

color : color of the edge line. See ColorTools/Format

– 

fontcolor : color of the weight label. See ColorTools/Format

– 

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

– 

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

– 

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

– 

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

– 

linestyle : style of the edge line, a string: solid, dot, dash, dashdot, longdash, spacedash, or spacedot. See plot/options

– 

thickness : thickness of the edge line, a nonnegative value

Examples

withGraphTheory:

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

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

(1)

BBiconnectedComponentsG

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

(2)

CInducedSubgraphG,B1

CGraph 2: an undirected unweighted graph with 3 vertices and 3 edge(s)

(3)

HighlightSubgraphG,C,Blue,Yellow

DrawGraphG,style=spring

HighlightSubgraphG,C,edgestylesheet=thickness=4,vertexstylesheet=thickness=4,color=White

DrawGraphG

PSpecialGraphs:-PetersenGraph

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

(4)

P1InducedSubgraphP,1,2,3,4,5:

P2InducedSubgraphP,6,7,8,9,10:

HighlightSubgraphP,P1,P2,Blue,Green,White,Black

DrawGraphP

HighlightSubgraphP,P1,P2,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