Mathematica > Mathematics and Algorithms > Graphs & Networks > Graph Programming > PropertyValue >
Mathematica > Visualization and Graphics > Graphs & Networks > Graph Programming > PropertyValue >
Mathematica > Mathematics and Algorithms > Graphs & Networks > Graph Representation and Properties > Graph Programming > PropertyValue >

PropertyValue

PropertyValue
gives the property value associated with name for item in obj.
  • Properties are used to store and manipulate pairs for specific named items within an object such as Graph.
  • PropertyValue[{obj, item}, name]=val can be used to modify the property value.
  • The items available for Graph objects include vertices and edges.
Generate a complete graph with properties:
Retrieve the property value associated with property name:
Change the property value:
Unset the property value:
Generate a complete graph with properties:
In[1]:=
Click for copyable input
Out[1]=
Retrieve the property value associated with property name:
In[2]:=
Click for copyable input
Out[2]=
Change the property value:
In[3]:=
Click for copyable input
In[4]:=
Click for copyable input
Out[4]=
Unset the property value:
In[5]:=
Click for copyable input
In[6]:=
Click for copyable input
Out[6]=
Set a property value for vertex 1:
Retrieve the property value for vertex 1:
Set a property value for the edge :
Retrieve the property value for the edge :
Unset properties for vertices:
And edges:
PropertyValue returns $Failed for undefined properties:
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 Do to set several property values:
Or different property values for different items:
Use Table to build a list of property values:
Create a weighted graph:
Set edge weights:
Compute weight scale:
Set the edge thickness to reflect the edge weight:
Highlight a path and mark the beginning point and endpoint:
Select vertices along a path:
Highlight by setting edge style along the path and vertex labels for start point and endpoint:
Dynamically highlight the edges in the order given by EdgeList:
Do five updates a second:
Dynamically visualize breadth-first search:
Use Property as a wrapper to specify properties in functions such as Graph:
Use PropertyList to test for the presence of a property:
Generate a list of vertex label rules:
Use SetProperty to set a property without changing the original:
The original graph is unchanged:
Use RemoveProperty to remove a property without changing the original:
The original graph is unchanged:
PropertyValue returns $Failed for undefined properties:
Use PropertyList to test for the presence of a property:
PropertyValue may return $Failed even when a property value exists:
Use PropertyList to check for actual property values:
New in 8
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF