is an option for Tree and related functions that specifies a function to use to generate primitives for rendering edges.
ParentEdgeShapeFunction
is an option for Tree and related functions that specifies a function to use to generate primitives for rendering edges.
Details
- ParentEdgeShapeFunction allows specifying the function to generate the shape of the parent edge of the root node of a tree, as well as that of any subtrees at positions matching a pattern.
- The following option settings can be used:
-
Automatic use the automatic shape None do not render the edge » "name" a named edge shape function » func a general edge shape function Allfunc use shape function func for all edges » TreeCases[pattern]func use func for edges at nodes with data matching pattern » "Leaves"func use func for edges at leaves » "NonLeaves"func use func for edges at non-leaves » {pos1func1,pos2func2,…} use funci for the edge at relative position posi » {patt1func1,patt2func2,…} use funci for edges at positions matching patti » - Edge style specifications are effectively applied in the order ParentEdgeStyle, ParentEdgeStyleFunction and ParentEdgeShapeFunction, with later specifications overriding the earlier ones.
- ParentEdgeShapeFunctionfunc specifies that the parent edge of the root node should be rendered with the primitives provided by func[{{x1,y1},{x2,y2}},data], where {{x1,y1},{x2,y2}} is a line segment and data is the data in the root.
Examples
open all close allBasic Examples (4)
Do not render an individual edge:
Tree[0, {Tree[1, {2, 3}, ParentEdgeShapeFunction -> None]}]Specify a list of edge shape functions:
Tree[0, {Tree[1, {2, 3}, ParentEdgeShapeFunction -> {{} -> None, {1} -> "DashedLine", {2} -> (InfiniteLine[#]&)}]}]Use the same shape function for all edges:
Tree[0, {Tree[1, {2, 3}, ParentEdgeShapeFunction -> All -> None]}]Specify shape functions for the leaf and non-leaf edges:
Tree[0, {Tree[1, {2, 3}, ParentEdgeShapeFunction -> {"Leaves" -> "DashedLine", "NonLeaves" -> None}]}]Scope (5)
ParentEdgeShapeFunction Gallery (3)
Get a list of built-in settings for EdgeShapeFunction:
ResourceData["EdgeShapeFunction"]Tree[{Tree[None, ParentEdgeShapeFunction -> "Line"]}]Lines with different glyphs on the edges:
Table[Tree[{Tree[None, ParentEdgeShapeFunction -> {ef, "ArrowSize" -> 0.1}]}, PlotLabel -> ef], {ef, {"BoxLine", "DiamondLine", "DotLine"}}]Directed edges including solid arrows:
Table[Tree[{Tree[None, ParentEdgeShapeFunction -> {ef, "ArrowSize" -> 0.1}]}, PlotLabel -> ef], {ef, {"HalfFilledArrow", "HalfFilledDoubleArrow", "FilledArcArrow", "FilledArrow", "ShortFilledArcArrow", "ShortFilledArrow"}}]Table[Tree[{Tree[None, ParentEdgeShapeFunction -> {ef, "ArrowSize" -> 0.1}]}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "UnfilledArrow"]}]Table[Tree[{Tree[None, ParentEdgeShapeFunction -> {ef, "ArrowSize" -> 0.1}]}, PlotLabel -> ef], {ef, ResourceData["EdgeShapeFunction", "CarvedArrow"]}]Position Specification (2)
Specify positions using position patterns:
Tree[0, {Tree[1, {[image], [image]}, ParentEdgeShapeFunction -> {{} -> None, {___, 1} -> (InfiniteLine[#]&), {2} -> "DashedLine"}]}]Specify positions using data patterns:
Tree[0, {Tree[1, {[image], [image]}, ParentEdgeShapeFunction -> {TreeCases[1] -> None, TreeCases[_ ? EvenQ] -> (InfiniteLine[#]&), TreeCases[_ ? OddQ] -> "DashedLine"}]}]Properties & Relations (4)
Shapes for edges can be specified by position:
Tree[0, {Tree[1, {[image], [image]}, ParentEdgeShapeFunction -> {{} -> None, {___, 1} -> (InfiniteLine[#]&), {2} -> "DashedLine"}]}]Shapes specified by a subtree take precedence over shapes specified by its ancestors:
Tree[0, {Tree[1, {Tree[2, {3}, ParentEdgeShapeFunction -> Automatic]}, ParentEdgeShapeFunction -> All -> "DashedLine"]}]A position {i,j,…} in a subtree refers to its subtree at relative position {i,j,…}:
Tree[1, {Tree[2, {3, 4}, ParentEdgeShapeFunction -> {{2} -> None}]}]A relative position {2} at position {1} refers to the global position {1,2}:
Tree[1, {[image]}, ParentEdgeShapeFunction -> {{1, 2} -> None}]In general, a pattern patt applies to subtrees at global position {i,j,…} that match patt:
Tree[1, {Tree[2, {3, 4}, ParentEdgeShapeFunction -> {pos_ /; Total[pos] === 2 -> None}]}]A list of patterns {patt1,patt2,…} applies to relative positions {i,j,…} that match patti:
Tree[1, {Tree[2, {3, 4}, ParentEdgeShapeFunction -> {{1} -> None}]}]Related Guides
History
Text
Wolfram Research (2022), ParentEdgeShapeFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/ParentEdgeShapeFunction.html.
CMS
Wolfram Language. 2022. "ParentEdgeShapeFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ParentEdgeShapeFunction.html.
APA
Wolfram Language. (2022). ParentEdgeShapeFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ParentEdgeShapeFunction.html
BibTeX
@misc{reference.wolfram_2026_parentedgeshapefunction, author="Wolfram Research", title="{ParentEdgeShapeFunction}", year="2022", howpublished="\url{https://reference.wolfram.com/language/ref/ParentEdgeShapeFunction.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_parentedgeshapefunction, organization={Wolfram Research}, title={ParentEdgeShapeFunction}, year={2022}, url={https://reference.wolfram.com/language/ref/ParentEdgeShapeFunction.html}, note=[Accessed: 13-June-2026]}