Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Graphs & Networks > Graph Programming > SetProperty >
Mathematica > Visualization and Graphics > Graphs & Networks > Graph Programming > SetProperty >
Mathematica > Mathematics and Algorithms > Graphs & Networks > Graph Representation and Properties > Graph Programming > SetProperty >

SetProperty

SetProperty
sets the property for item in obj.
  • Properties are used to store and manipulate pairs for specific named items within an object such as Graph.
  • SetProperty will produce a new graph with a modified property value.
  • The items available for Graph objects include vertices and edges.
Specify a vertex or edge property:
Use SetProperty to override the vertex style:
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]=
Set properties for vertices:
And edges:
Set several properties for a vertex:
And for an edge:
Standard vertex properties include VertexStyle:
Non-visual properties include VertexWeight:
Set a custom property:
Standard edge properties include EdgeStyle:
Non-visual properties include EdgeWeight:
Set a custom property:
Use Fold to apply SetProperty repeatedly:
See all the partial results:
Create a graph:
Temporarily highlight one vertex:
Then another:
Highlight the edges visited during a breadth-first scan:
Use Property as a wrapper to specify properties in functions such as Graph:
Use PropertyValue to extract values:
For undefined properties the value $Failed is returned:
Use PropertyValue to set properties in a graph:
The original graph has changed:
Use PropertyValue to unset properties in a graph:
The original graph has changed:
Use PropertyList to test for the presence of a property:
Generate a list of vertex label rules:
Use RemoveProperty to remove a property without changing the original:
The original graph is unchanged:
PropertyValue is typically faster than SetProperty:
New in 8
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF