Next: Vertex Graphics Up: Graph Objects Previous: Graph Queries

## Graph Views

Figure 9.4: Manipulating attributes
| (make <graph-view> :graph graph :xpixels xpixels :ypixels ypixels :layout layout )

Create and return a toplevel window containing a view of graph. The keyword arguments are optional, where graph is a <graph*> object, xpixels and ypixels are integer values, and layout is a symbol naming the layout algorithm. At this time, the layouts available are: 'circular, 'random, 'spring, and 'bipartite. A copy of graph is made and retained in the <graph-view> object.

| (name gv)

(slot) Holds the name of the graph, which corresponds to the name attribute of the Graphclass in C++.

| (graph gv)

(slot) Holds the associated <graph*> object, which name attribute of the Graphclass in C++.

| (xpixels gv)

(slot) Defines the width of the graph's canvas widget. Changing its value causes the graph to be redrawn. Note that the window can be resized using the mouse. Such an operation does not automatically cause the graph to be redrawn (that would be too slow). Instead, there is a ``redraw'' option in the ``Graph-View'' menu which modifies xpixels and ypixels.

| (ypixels gv)

(slot) Defines the height of the graph's canvas widget. The discussion of xpixels pertains to this slot also.

| (title gv

(slot) Stores the title displayed in the toplevel window of the <graph-view> object (not necessarily the name of the graph).

| (graph-toplevel gv)

(slot) Holds the Tk toplevel window in which the graph window's menu and canvas are packed.

| (graph-canvas gv)

(slot) Holds the Tk canvas widget in which the graph's vertices and edges are drawn.

| (vertex-table gv)

(slot) Holds the STk hash table which allows the user or programmer to search, given a <vertex*> object, for the associated <vertex-item>.

| (edge-table gv)

(slot) Holds the STk hash table which allows the user or programmer to search, given a <edge*> object, for the associated <edge-item>.

| (segment-table gv)

(slot) Holds the STk hash table which, allows the user or programmer to search, given a the integer tag of a <line> or <text-time> return the associated <edge-segment-item> object. This is used by the selection and dragging mechanism and may not be of any interest to the user.

| (vertex-tag-table gv)

(slot) Holds the STk hash table which allows the user or programmer to search, given the tag of an <oval> or <text-item> for the associated <vertex-item> object. This is used by the selection and dragging mechanism and may not be of any interest to the user.

| (edge-tag-table gv)

(slot) Holds the STk hash table which allows the user or programmer to search, given the tag of an <oval> or <text-item> for the associated <edge-item> object. This is used by the selection and dragging mechanism and may not be of any interest to the user.

| (vertices gv)

(method) Returns a list of all <vertex-item> objects in gv .

| (edges gv)

(method) Returns a list of all <edge-item> objects in gv .

| (update-graph-view gv)

(method) Updates the attributes of the <graph-view> and its associated <graph*>.

| (path-draw gv)

(method) Changes the visual appearance of each <edge-item> in the graph to be ``path-draw,'' i.e., a single path of line segments through the member vertices. This is the default edge drawing style.

| (star-draw gv)

(method) Changes the visual appearance of each <edge-item> in the graph to be ``star-draw,'' i.e., a central edge label with line segments to each member vertex.

| (layout-edge ei gv)

(method) Is used primarily to view hyperedges. It changes the drawing mode of <edge-item> ei to be ``star-draw,'' and updates the location of the central edge label.

| (layout-edges gv)

(method) Calls layout-edge for each <edge-item> in gv.

| (hide-label vi )

(method) Makes the label associated with <vertex-item> vi invisible.

| (show-label vi )

(method) Makes the label associated with <vertex-item> vi visible.

(hide-labels gv) |
(show-labels gv) |

These methods hide and show all labels associated with the vertices and edges of gv.

(hide-vertex-labels gv) |
(show-vertex-labels gv) |

(method) Hides all labels associated with the vertices of gv.

(hide-edge-labels gv) |
(show-edge-labels gv) |

(method) Hides all labels associated with the edges of gv.

(reset-label vi ) |
(reset-label ei) |

(method) Resets the label slots of the given <vertex-item> or <edge-item> to be the name of the associated <vertex*> or <edge*> C++ object.

| (reset-labels gv)

(method) Calls reset-label for each <vertex-item> and <edge-item> of gv.

| (reset-colors gv)

(method) Resets the colors of each <vertex-item> and <edge-item> to their default values.

| (reset-graphics gv)

(method) Calls reset-colors and reset-labels.

| (vertex-item vertex gv)

(method) Returns the <vertex-item> object associated with <vertex*> vertex in <graph-view> gv .

| (edge-item edge gv)

(method) Returns the <edge-item> object associated with <edge*> edge in <graph-view> gv.

(vertex-items vlist gv) |
(vertex-items mset-vertex gv) (vertex-items set-vertex gv) |

(method) Returns the list of <vertex-item> objects of <graph-view> gv associated with the <vertex*> objects in list vlist , <mset<vertex*>> mset-vertex, or <set<vertex*>> set-vertex.

(edge-items elist gv) |
(edge-items mset-edge gv) (edge-items set-edge gv) |

(method) Returns the list of <edge-item> objects of <graph-view> gv associated with the <edge*> objects in list elist , <mset<vertex*>> mset-edge, or <set<vertex*>> set-edge.

| (graph-view? gv)

(method) Returns #t if gv is a <graph-view> object.

| (replace-graph g gv)

The graph displayed in graph-view gv is replaced by g. The former is deleted.

| (collapse-subgraph <list-of-vertex-items> gv)

The vertices in <list-of-vertex-items> are identified into a subgraph, which can later be expanded. The latter is represented by a ``super-vertex,'' which is returned.

| (expand-subgraph vg gv)

If <vertex-item> vg is a super-vertex, replace it with the subgraph is represents. The return value is the set of vertices which comprised the subgraph (or vg if it is not a super-vertex.

Figure 9.5: Defining graph functions:

Next: Vertex Graphics Up: Graph Objects Previous: Graph Queries