GraphTheory[GetGraphAttribute]
GraphTheory[GetVertexAttribute]
GraphTheory[GetEdgeAttribute]
GraphTheory[SetGraphAttribute]
GraphTheory[SetVertexAttribute]
GraphTheory[SetEdgeAttribute]
GraphTheory[ListGraphAttributes]
GraphTheory[ListVertexAttributes]
GraphTheory[ListEdgeAttributes]
GraphTheory[DiscardGraphAttribute]
GraphTheory[DiscardVertexAttribute]
GraphTheory[DiscardEdgeAttribute]
|
Calling Sequence
|
|
SetGraphAttribute(G, attr)
SetVertexAttribute(G, v, attr)
SetEdgeAttribute(G, e, attr)
GetGraphAttribute(G, tag)
GetVertexAttribute(G, v, tag)
GetEdgeAttribute(G, e, tag)
DiscardGraphAttribute(G, tag)
DiscardVertexAttribute(G, v, tag)
DiscardEdgeAttribute(G, e, tag)
ListGraphAttributes(G)
ListVertexAttributes(G, v)
ListEdgeAttributes(G, e)
|
|
Parameters
|
|
G
|
-
|
graph
|
v
|
-
|
vertex
|
e
|
-
|
edge/arc
|
attr
|
-
|
equation or list of equations
|
tag
|
-
|
(optional) simple type or list
|
|
|
|
|
Description
|
|
•
|
SetVertexAttribute(G,v,attr) is used to store arbitrary information in the form of tag=value for vertex v in a graph G. These equations are called attributes. The argument attr can be a single attribute to be assigned to v or a list of attributes. Note that for a fixed vertex, tags must be unique. If the vertex already has an attribute with the given tag, the command reassigns the value of that tag to the new value provided by attr.
|
•
|
GetVertexAttribute(G,v,tag) is used to retrieve all or some of the attributes of vertex v. If tag is a single tag, then the value corresponding to that tag is returned. If no attribute with the specified tag is defined for v the command returns FAIL. The argument tag can also be a list of tags in which case a list of values is returned.
|
•
|
DiscardVertexAttribute(G,v,tag) is used to discard all or some of the attributes of the vertex v in the graph G. If the optional argument tag is not present, all attributes of v are discarded. If a single tag or a list of tags is specified then the attributes corresponding to those tags are discarded. If an attribute with the given tag is not found, the command does nothing.
|
•
|
ListVertexAttributes(G,v) is used to list all attributes for vertex v in the graph G. It outputs a list, possibly empty, of the tags used for the attributes in G.
|
•
|
SetGraphAttribute, GetGraphAttribute, DiscardGraphAttribute, ListGraphAttributes are similar to their vertex analogues and are used to manage attributes of a graph rather than a particular vertex in a graph.
|
•
|
SetEdgeAttribute, GetEdgeAttribute, DiscardEdgeAttribute, ListEdgeAttributes are similar to their vertex analogues but are used to manage attributes of the edges of a graph instead of a vertex in a graph.
|
|
|
Examples
|
|
>
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
>
|
|
|
|