Now we will load a graph for visualization. Graphs are stored in files with a .daVinci suffix, containing a so called term representation. This format only defines the structure of a graph, but has no layout informations such as the coordinate of a particular node. The term representation format is discussed in detail in the reference chapter. To load a graph, you need the file browser for selecting a file name. You can get a browser by selecting menu File/Open... (i.e. move the mouse pointer to the File pull down menu and press the right mouse button which will show the File menu. Then move the mouse pointer to the Open... menu entry by still pressing the right mouse button and finally release the mouse button when you are over the Open... menu entry). This will pop up the file browser for opening a graph.
The file browser has two different lists: One for the directories inside the current directory and one for the files in the current directory. The current directory is always displayed in the Selection field of the file browser. Now you can browse through the directories of the file system of your computer by double-clicking the list elements of the Directories view with the left mouse button (the left mouse button is used to select or manipulate objects visible on the screen, whereby the right button is used to choose from a menu). A double-click on '..', the first element of the directory list, will move to the parent directory. When there is not enough place to show all directories or files, then you can use the vertical scrollbars at the right side of the lists to move the focus. Finally, go into the example_graphs/ directory of the daVinci distribution. Ask your administrator if you are not sure about the location of the daVinci distribution on your file system.
When you are inside the example_graphs/ directory, click on the
Types option button to select the Graph Files filter.
This will remove all files without suffix .daVinci from the
files view. Now double-click on file graph_example.daVinci to
load this graph in daVinci. This finishing action will automatically
close the file browser.
As you can see on the screen, all graph nodes are automatically placed on
horizontal levels such that all (directed) edges between two nodes are pointing
downwards. This is called a hierarchical visualization of a directed graph.
Other styles of graph layout are currently not supported by daVinci.
Background information about graphs
can be found in the concept document.
Except of assigning nodes to levels, the graph layout algorithm is not
used directly after loading a graph, to display it as soon as possible.
By looking at the graph visualization, you can see that the layout is not
as good as it can be. For example, several edges cross eachother, which
makes the layout confusing and somehow unattractive. You can see the total
number of edge crossings of the current graph layout by opening a statistic
window with menu
View/Graph Info....
Improving the graph layout can be done by reordering the nodes at each level
such that the number of edges is reduced. daVinci offers an automatic
graph layout algorithm for this task. Start this algorithm by using menu
Layout/Improve All. After doing
so, you will notice a significantly improved layout. You can read
more about graph layout
in the concept document.
In daVinci, a graph is drawn top-down by default, so edges are
usually pointing downwards. You can choose one of the other three layout
orientations (upwards, to the left or to the right) with menu
Layout/Orientation. For example,
try to rotate the layout by selecting menu
Layout/Orientation/Left to Right.
Again, you need a file browser to save the current layout to a status file.
One way to do so is by selecting menu
File/Save As....
But at this time, we will use the icon bar of the base window for more comfort.
Move the mouse pointer to the save button which looks like this:
Button of the icon bar to save a graph
In the file browser, you have to choose the file type you want to save by
using the Types
option button: Either Status Files (default) or Graph Files.
Saving the current graph in term representation format by using type
Graph Files does not make
sense at the moment, because the structure of the graph is still the same,
which means that you would get the same file as loaded before.
So use the default type Status Files such that the title of the
browser window shows "Save As Status".
The browser usually suggests a name for the file you want to save. The filename
of the graph (term representation) you have loaded before is
graph_example.daVinci, so the suggested filename is
graph_example.status. Status files should usually have suffix
.status. Unfortunately, the suggested filename already exists (as you
can see in the Files view of the browser) and you do not want to
overwrite it. By the way, the browser will ask the user before overwriting
files. So choose a new name for your file by editing the Selection
field of the browser.
Click in the field to get a text cursor and erase the filename (but not the
directory) with the Backspace key.
Then enter a new filename, e.g. my_graph.status, and press the
Save push button to start the saving operation.
If you do not have write permissions for the example_graphs
directory of the daVinci distribution, then saving will
fail and a notice window will appear. In this case, open the browser again
to repeat this operation, but at this time choose another directory where you
have permissions to write, for example your home directory.
But at this time, we will use the keyboard instead of the mouse for choosing
this menu operation. Press the keys Alt and f simultaneously
which is usually written as Alt+F. This will open the File menu.
f is the underlined character (mnemonic) of the
File menu, the keyboard equivalent for mouseless operation.
After opening the menu with these two keys, you can navigate through all
menus with the four cursor keys of the keyboard. By pressing Return,
you select the currently highlighted menu entry. In an opened menu, you have
another option to choose from a menu by pressing the mnemonic character
(at this time without the Alt key!)
of one of the menu entries. For example, when the File menu is open,
you select Print... by pressing the p key. So the overall
keyboard command to select this particular menu is Alt+F P (upper
case letters are not significant here). You can read
more about keyboard usage by following this
reference.
After opening the
print dialog window with
one of the methods described above, you have the opportunity to set some
options before the file will actually be printed. Lets asume you want to print
the currently loaded graph on one of the PostScript printers in your network.
First of all, you need to know the UNIX command used for printing PostScript
files at your site. For example, if you usually use command
Starting the Graph Layout Algorithm
After successfully loading the graph graph_example.daVinci from file,
the visualization should immediately appear in the graph area of the
base window. This graph is larger than the base window, so you can
only see a portion of the whole graph visualization. Use the two scrollbars of
the base window to move the focus to other areas of the graph. A more
comfortable method to set the focus in a large graph visualization is
2D-scrolling. This operation is available
inside the graph area of a base window if you press and hold down the middle
mouse button while moving the mouse. Try this with the current graph and you
will see how the system scrolls in both directions simultaneously by following
the movements of the mouse.
Saving the Status of a Graph
Assuming that you are a careful person, you might wish to store the current
layout of the graph in a file. As stated above, a term representation file does
not contain
layout informations, so this way your modifications will be lost in a later
session. To store a graph together with informations about the current layout
(node coordinates etc), you can choose daVinci's alternative graph
storage format,
called status. A status also contains most of the user interface
settings, so by loading a status file, a previous session can be restored very
easily.
Printing a Graph Visualization
You can print a graph on a PostScript printer directly from daVinci
to get the current layout on paper. For this operation the
print dialog
window is needed which will appear after selecting menu
File/Print... (or by pressing
the printer button of the icon bar).
Go back to the Tutorial Overview
daVinci V2.1 Online Documentation - Page update: June 15, 1998