GraphTheory - Maple Programming Help

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

GraphTheory

 HighlightEdges
 highlight the edges of a graph

 Calling Sequence HighlightEdges(G, E) HighlightEdges(G, E, C, ip) HighlightEdges(G, E, stylesheet=[ optionsequence ], ip)

Parameters

 G - graph E - a single edge or a list or set of edges of G or a subgraph of G or a list or set of subgraphs 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. The command HighlightEdges, marks the specified edges to be rendered with the default highlighted style.
 • Given only a graph G and an edge or edges E, HighlightEdges marks the specified edges to be rendered with the default highlighted style.  If E is one or more subgraphs of G, then the edges in those subgraphs are highlighted.  Use HighlightSubgraph instead if you want to highlight both edges and vertices of the subgraphs.
 • If you want to highlight a edge but give it a different color, then give C, a color for the edge. The colors C can be given in any form understood by Maple. See ColorTools/Formats for details.
 • If E is a list of edges or 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 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 StyleEdge for a complete list of edge 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)
 > $\mathrm{HighlightEdges}\left(\mathrm{K5},\left\{1,2\right\}\right)$
 > $\mathrm{DrawGraph}\left(\mathrm{K5}\right)$
 > $\mathrm{HighlightEdges}\left(\mathrm{K5},\left[\left\{2,3\right\},\left\{4,5\right\}\right],\mathrm{stylesheet}=\left[\mathrm{thickness}=3\right]\right)$
 > $\mathrm{DrawGraph}\left(\mathrm{K5}\right)$
 > $\mathrm{ST}≔\mathrm{SpanningTree}\left(\mathrm{K5}\right)$
 ${\mathrm{ST}}{≔}{\mathrm{Graph 2: an undirected unweighted graph with 5 vertices and 4 edge\left(s\right)}}$ (2)

If we want a version of $\mathrm{K5}$ with $\mathrm{ST}$ highlighted, but we also want to keep the current version of $\mathrm{K5}$, we can use the $\mathrm{inplace}$ option.

 > $\mathrm{K5_with_ST}≔\mathrm{HighlightEdges}\left(\mathrm{K5},\mathrm{ST},"Gold",\mathrm{inplace}=\mathrm{false}\right)$
 ${\mathrm{K5_with_ST}}{≔}{\mathrm{Graph 3: an undirected unweighted graph with 5 vertices and 10 edge\left(s\right)}}$ (3)
 > $\mathrm{DrawGraph}\left(\mathrm{K5_with_ST}\right)$

$\mathrm{K5}$ is unmodified.

 > $\mathrm{DrawGraph}\left(\mathrm{K5}\right)$
 > $M≔\mathrm{Matrix}\left(\left[\left[0,2,9\right],\left[4,0,1\right],\left[3,0,0\right]\right]\right)$
 ${M}{≔}\left[\begin{array}{ccc}{0}& {2}& {9}\\ {4}& {0}& {1}\\ {3}& {0}& {0}\end{array}\right]$ (4)
 > $G≔\mathrm{Graph}\left(M\right)$
 ${G}{≔}{\mathrm{Graph 4: a directed weighted graph with 3 vertices and 5 arc\left(s\right)}}$ (5)
 > $\mathrm{HighlightEdges}\left(G,\left[2,3\right],\mathrm{stylesheet}=\left[\mathrm{fontstyle}="bold",\mathrm{fontcolor}="Red",\mathrm{color}="Green",\mathrm{thickness}=3\right]\right)$
 > $\mathrm{DrawGraph}\left(G\right)$
 > $P≔\mathrm{SpecialGraphs}:-\mathrm{PetersenGraph}\left(\right)$
 ${P}{≔}{\mathrm{Graph 5: an undirected unweighted graph with 10 vertices and 15 edge\left(s\right)}}$ (6)
 > $\mathrm{P1}≔\mathrm{InducedSubgraph}\left(P,\left[1,2,3,4,5\right]\right)$
 ${\mathrm{P1}}{≔}{\mathrm{Graph 6: an undirected unweighted graph with 5 vertices and 5 edge\left(s\right)}}$ (7)
 > $\mathrm{P2}≔\mathrm{InducedSubgraph}\left(P,\left[6,7,8,9,10\right]\right)$
 ${\mathrm{P2}}{≔}{\mathrm{Graph 7: an undirected unweighted graph with 5 vertices and 5 edge\left(s\right)}}$ (8)
 > $\mathrm{HighlightEdges}\left(P,\left[\mathrm{P1},\mathrm{P2}\right],\left["Blue","Green"\right]\right)$
 > $\mathrm{DrawGraph}\left(P\right)$
 > $\mathrm{HighlightEdges}\left(P,\left[\left\{1,6\right\},\left\{2,9\right\},\left\{3,7\right\},\left\{4,10\right\},\left\{5,8\right\}\right],\mathrm{stylesheet}=\left[\mathrm{seq}\left(\left[\mathrm{thickness}=i\right],i=2..10,2\right)\right]\right)$
 > $\mathrm{DrawGraph}\left(P\right)$

Compatibility

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