style graph edges by property
StyleEdgesByProperty(G, P, ip)
either a matrix or table of numeric values, specifying values for each edge of G, or a procedure that returns a matrix or table of numeric values, specifying values for each edge of G
(optional) equation of the form inplace = true or inplace = false
colorscheme : colors
This sets edgecolor using ColorTools:-Blend
This sets edgethickness. The value can be zero, but for best results should be positive
arrowsizescheme : nonnegative
This sets arrowsize
arrowposscheme : 0..1
This sets arrowpos
arrowshapescheme : string
This sets arrowshape. Only valuesplit schemes are supported.
linestylescheme : string
This sets linestyle. Only valuesplit schemes are supported.
scheme : list_of_styles
This only supports valuesplit schemes. For each value a custom list of stylesheet properties can be given.
All styling schemes scale the values in P to the range 0..1 based on the minimum and maximum values in P. The range option overrides that and does a linear scaling where lhs(range) becomes to 0 and rhs(range) becomes 1. This is useful for achieving consistent styling across multiple graphs. After scaling, values less than 0 will be treated the same as 0 and values greater than 1 will be treated the same as 1.
By default all the styling schemes linearly interpolate between styles equally spaced across on interval. The markers option allows you to specify exactly which values between 0 and 1 are assigned to each style. The value of markers must be a sorted list of values between 0 and 1 which is the same length as the list of values given to each scheme.
Limitation: If multiple style scheme are being used with markers all the schemes must have the same number of values. The best work around is to just invoke this command twice on the same graph.
By default the DrawGraph command draws the edges and vertices of the graph with the same set of style options. The command StyleEdgesByProperty, allows you to set styles for all vertices according to a property.
Every style scheme can also be given as a valuesplit scheme. Instead of a list of values to blend between, a valuesplit scheme assigns a discrete set of styles by exact value, range, or list or set of values given as a list of equations and default value. The equations match the property value to the left-hand side and use the value on the right-hand side. For example, colorscheme=["valuesplit", [1="Blue", 2..3="Red", [4,5]="Green", "DarkGrey"] ] If no default value is given, unmatched properties will not be given a style.
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.
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
arrowshape : a string understood by plottools/polygonbyname or "line" specifying the shape of the arrowhead on a directed edge
color : color of the edge line. See ColorTools/Format. Special color values are supported
Special value "_contrast" sets the color to a grayscale value that contrasts with the background color of the plot.
Special value "_match" sets the font color to the weight color.
Special value "_blend" also sets the font color to average of the colors of the vertices on each end of the edge.
fontcolor : color of the weight label. See ColorTools/Format. Special color values are supported.
Special value "_contrast" sets the font to a grayscale value that contrasts with the background color of the plot.
Special value "_match" (the default) sets the font color to the edge color.
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 non-negative value
G≔Graph 1: an undirected weighted graph with 6 vertices and 7 edge(s)
Graph 1: an undirected weighted graph with 6 vertices and 7 edge(s)
Here is an example of how to use the output of EdgeChromaticNumber to create an edge coloring
G2≔Graph 2: an undirected unweighted graph with 10 vertices and 15 edge(s)
edgecolor := proc(G) local i, e, color;
for e in Edges(G) do
for i from 1 to nops(coloring) do
if e in coloring[i] then
color[e] := i;
edgecolor:=procGlocali,e,color;foreinGraphTheory:-Edges⁡Gdoforitonops⁡coloringdoifeincoloring[i]thencolor[e]:=iend ifend doend do;returncolorend proc
G3≔Graph 3: an undirected unweighted graph with 10 vertices and 15 edge(s)
The GraphTheory[StyleEdgesByProperty] command was introduced in Maple 2020.
For more information on Maple 2020 changes, see Updates in Maple 2020.
Download Help Document
What kind of issue would you like to report? (Optional)