SetProperty

SetProperty[{obj,itemspec},namevalue]

sets the property namevalue for itemspec in obj.

Details

  • Properties are used to store and manipulate name->value pairs for specific named items within an object such as Graph.
  • SetProperty will produce an object with a modified property value.
  • The item specification itemspec typically has the form {collection,index}.
  • The index can typically have the following forms:
  • inda single index
    {ind1,ind2,}a list of indexes
    Allall possible indexes in collection
    pattindexes that match patt in collection
  • The collection can typically have the following forms:
  • cola single collection
    {col1,col2,}a list of collections
    Allall possible collections
    pattcollections that match patt
  • The item specification itemspec of the form collection refers to the default value for all indexes in the collection.
  • The items available for Graph objects include vertices and edges.

Examples

open allclose all

Basic Examples  (2)

Specify a vertex or edge property:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Use SetProperty to override the vertex style:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Scope  (6)

Applications  (3)

Properties & Relations  (6)

Possible Issues  (1)

See Also

PropertyList  PropertyValue  RemoveProperty  Property  Graph

Introduced in 2010
(8.0)