Tcl Library Source Code

Documentation
Login


[ Main Table Of Contents | Table Of Contents | Keyword Index | Categories | Modules | Applications ]

NAME

struct::graph_v1 - Create and manipulate directed graph objects

Table Of Contents

SYNOPSIS

package require Tcl 8.5 9
package require struct::graph ?1.2.2?

graphName option ?arg arg ...?
graphName destroy
graphName arc append arc ?-key key? value
graphName arc delete arc ?arc ...?
graphName arc exists arc
graphName arc get arc ?-key key?
graphName arc getall arc
graphName arc keys arc
graphName arc keyexists arc ?-key key?
graphName arc insert start end ?child?
graphName arc lappend arc ?-key key? value
graphName arc set arc ?-key key? ?value?
graphName arc source arc
graphName arc target arc
graphName arc unset arc ?-key key?
graphName arcs ?-key key? ?-value value? ?-in|-out|-adj|-inner|-embedding nodelist?
graphName node append node ?-key key? value
graphName node degree ?-in|-out? node
graphName node delete node ?node ...?
graphName node exists node
graphName node get node ?-key key?
graphName node getall node
graphName node keys node
graphName node keyexists node ?-key key?
graphName node insert ?child?
graphName node lappend node ?-key key? value
graphName node opposite node arc
graphName node set node ?-key key? ?value?
graphName node unset node ?-key key?
graphName nodes ?-key key? ?-value value? ?-in|-out|-adj|-inner|-embedding nodelist?
graphName get ?-key key?
graphName getall
graphName keys
graphName keyexists ?-key key?
graphName set ?-key key? ?value?
graphName swap node1 node2
graphName unset ?-key key?
graphName walk node ?-order order? ?-type type? ?-dir direction? -command cmd

DESCRIPTION

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:

Bugs, Ideas, Feedback

This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category struct :: graph of the Tcllib Trackers. Please also report any ideas for enhancements you may have for either package and/or documentation.

When proposing code changes, please provide unified diffs, i.e the output of diff -u.

Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.

KEYWORDS

cgraph, graph

CATEGORY

Data structures

COPYRIGHT

Copyright © 2002 Andreas Kupries