Property name Refers to Stored as Default
-------------------------------------------------------------
VertexWeight vertices list 1
VertexCapacity vertices list 1
VertexCoordinates vertices list none (*)
VertexSize vertices rules
VertexShape vertices rules
VertexShapeFunction vertices rules
VertexStyle vertices rules
VertexLabels vertices rules
VertexLabelStyle vertices rules
EdgeWeight edges list 1
EdgeCapacity edges list 1
EdgeCost edges list 1
EdgeStyle edges rules
EdgeShapeFunction edges rules
EdgeLabels edges rules
EdgeLabelStyle edges rules
* VertexCoordinates
is special in that it can only be set for an individual vertex if all vertices have already been assigned an explicit coordinate value using SetProperty[graph, VertexCoordinates -> {...}]
. It has no default.
A vertex property can be set for individual vertices as SetProperty[{g, vertex}, prop -> value]
. Similarly, an edge property can be set for individual edges as SetProperty[{g, edge}, prop -> value]
. A graph property can only be set as SetProperty[g, prop -> value]
for the complete graph.
List type properties are stored as a list of the same length as the number of elements they refer to (edges or vertices). When setting a list type property for in individual element (vertex or edge), the rest automatically get a default value. When setting a list type property for the whole graph, the length of the list must agree with the number of elements. Example:
SetProperty[g, VertexCapacity -> {1,2,3}] (* list length *must* agree with VertexCount *)
Rule type properties as stored as a list of rules, and may be assigned for a subset of elements (leaving the rest without an explicit value). Example:
g = Graph[{a,b,c}, ...];
SetProperty[g, VertexSize -> {a -> 1, b -> 2}] (* c will not have an assigned VertexSize *)
Rule type properties can also have a default value stored as the first element of the rule list. For certain types of properties (e.g. EdgeStyle
), this default will be combined with the individual values. Example:
g = Graph[{1 <-> 2, 2 <-> 3}];
SetProperty[g, EdgeStyle -> {Thick, 2 \[UndirectedEdge] 3 -> Red}]
Thick
will apply to all edges, including 2 <-> 3
, while Red
will apply only to 2 <-> 3
.