GraphTheory/GraphAttributes - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Discrete Mathematics : Graph Theory : GraphTheory Package : GraphTheory/GraphAttributes

GraphTheory/GraphAttributes

 

Calling Sequence

Parameters

Description

Examples

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

withGraphTheory:

withSpecialGraphs:

TCompleteBinaryTree3

TGraph 1: an undirected unweighted graph with 15 vertices and 14 edge(s)

(1)

SetVertexAttributeT,1,label=root

(2)

SetEdgeAttributeT,9,10,message=i am an edge!,cost=12.4

(3)

GetVertexAttributeT,1,label,message

root,FAIL

(4)

GetEdgeAttributeT,9,10

message=i am an edge!,cost=12.4

(5)

DiscardVertexAttributeT,1

DiscardEdgeAttributeT,9,10,message

See Also

CopyGraph

Graph