graph - Create and manipulate directed graph objects
SYNOPSIS
package require Tcl 8.2
package require struct ?1.2.1?
|
The ::struct::graph command creates a new graph object with an associated global Tcl command whose name is graphName. This command may be used to invoke various operations on the graph. It has the following general form:
A directed graph is a structure containing two collections of elements, called nodes and arcs respectively, together with a relation ("connectivity") that places a general structure upon the nodes and arcs.
Each arc is connected to two nodes, one of which is called the source and the other the target. This imposes a direction upon the arc, which is said to go from the source to the target. It is allowed that source and target of an arc are the same node. Such an arc is called a loop. Whenever a node is source or target of an arc both are said to be adjacent. This extends into a relation between nodes, i.e. if two nodes are connected through at least one arc they are said to be adjacent too.
Each node can be the source and target for any number of arcs. The former are called the outgoing arcs of the node, the latter the incoming arcs of the node. The number of edges in either set is called the in- resp. the out-degree of the node.
In addition to maintaining the node and arc relationships, this graph implementation allows any number of keyed values to be associated with each node and arc.
The following commands are possible for graph objects: