is an option and annotation for Graph and related functions that specifies a function to use to generate primitives for rendering each vertex.
VertexShapeFunction
is an option and annotation for Graph and related functions that specifies a function to use to generate primitives for rendering each vertex.
Details
- The following option settings can be used:
-
Automatic the default vertex functionNone do not render vertices"Name" use the vertex name"nfunc" a named vertex functionfunc a general vertex function{vi->vfi,…} use vertex function vfi for vertex vi{pattivfi,…} use vfi for vertices matching the pattern patti
- The wrapper Annotation [v,VertexShapeFunction->f] can be used when creating graphs in functions such as Graph etc.
- Use to get a list of all named vertex functions.
- VertexShapeFunction->func specifies that each vertex should be rendered with the primitives provided by func[{x,y},v,{w,h}], where {x,y} is the center, v the vertex name, and {w,h} the width and the height.
- In 3D, VertexShapeFunction->func specifies that each vertex should be rendered with the primitives provided by func[{x,y,z},v,{w,h,d}], where {x,y,z} is the center, v the vertex name and {w,h,d} the width and the height.
- The vertex function func should render the vertex primitives in the bounding box {{x-w,x+w},{y-h,y+h}} in 2D and {{x-w,x+w},{y-h,y+h},{z-d,z+d}} in 3D automatically computed by layout algorithms.
Examples
open all close allBasic Examples (4)
Draw vertices using a predefined vertex function:
Specify a vertex function for an individual vertex:
Use an Annotation wrapper to specify individual vertex functions:
Draw vertices by running a program:
Scope (13)
VertexShapeFunction Specification (9)
VertexShapeFunction can be used for general graphs:
Matrix graphs:
Special graphs:
Random graphs:
Use VertexShapeFunction in an Annotation wrapper:
VertexShapeFunction works with patterns:
VertexShapeFunction can be combined with VertexStyle :
VertexShapeFunction has higher priority than VertexStyle :
VertexShapeFunction can be combined with VertexSize :
VertexShapeFunction has higher priority than VertexShape :
VertexShapeFunction Gallery (4)
Get a list of built-in collections for VertexShapeFunction :
Use built-in settings for VertexShapeFunction in the "Basic" collection:
Simple basic shapes:
Common basic shapes:
Use built-in settings for VertexShapeFunction in the "Rounded" collection:
Use built-in settings for VertexShapeFunction in the "Concave" collection:
Possible Issues (1)
Use Inset to render graphics or an image:
VertexShape takes graphics or images used for vertices:
Related Guides
History
Text
Wolfram Research (2010), VertexShapeFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/VertexShapeFunction.html.
CMS
Wolfram Language. 2010. "VertexShapeFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/VertexShapeFunction.html.
APA
Wolfram Language. (2010). VertexShapeFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VertexShapeFunction.html
BibTeX
@misc{reference.wolfram_2025_vertexshapefunction, author="Wolfram Research", title="{VertexShapeFunction}", year="2010", howpublished="\url{https://reference.wolfram.com/language/ref/VertexShapeFunction.html}", note=[Accessed: 17-November-2025]}
BibLaTeX
@online{reference.wolfram_2025_vertexshapefunction, organization={Wolfram Research}, title={VertexShapeFunction}, year={2010}, url={https://reference.wolfram.com/language/ref/VertexShapeFunction.html}, note=[Accessed: 17-November-2025]}