VertexShapeFunction

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:
  • Automaticthe default vertex function
    Nonedo not render vertices
    "name"a named vertex function
    funca 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 GraphElementData["VertexShapeFunction"] 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.
  • The vertex function func should render the vertex primitives in the bounding box {{x-w,x+w},{y-h,y+h}} automatically computed by layout algorithms.

Examples

open allclose all

Basic 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:

Introduced in 2010
 (8.0)