# Edit DTE Diagrams

Users can edit both general graphs and type graphs. Undo/Rdo functionality is provided to make editing eaiser.

## Edit General Graphs

The default mode DTEvisual starts with allows users to drag the existing nodes in a general graph to change their positons. Users need to switch to other modes in order to add nodes/edges to a general graph. This is done by selecting the desired mode from the toolbar . A domain/type node is added by clicking on the position where users want to put it. A non-empty name is then required for the newly-added node. To add an edge between two nodes, users need to drag the mouse from one node to the other. Notice that no edge will be added if users attempt to add a wrong type of edge between the two nodes. For edges between domain nodes, a trigger whose format must match the foramt of a Linux file name has to be specified; for edges between domain nodes and type nodes, users need to specify the valid permissions which should only contain the characters 'c', 'r', 'w', 'x' and 'd'. No duplicated edges are allowed between any two nodes.

Users can also delete and change the name of a node/edge in a general graph. This is done through the context menu of the node/edge. Once a node is deleted, all the edges adjacent to the node are also deleted. Users will be asked whether to proceed when they try to delete a type node because deleting a type node will affect the nodes in the type graph whose types are the one to be deleted.

## Edit Type Graphs

The editing operations applicable to a node in type graphs include:

- change name
- change type
- delete type
- change flag
- assign type to a child node

All the editing operations can be accessed from a node's context menu. However, notice that the name of root node cannot be changed as the root is always '/'. When the type of a node is changed, DTEvisual checks each of its children to see if there is any child which inherits the node's type. The types of those children who inherit the node's type are also changed to the new type. The new type is not limited to the existing types in a general graph. Users can create a new type in the process of changing type, and a node representing the new type will be automatically added to the general graph.
Change the type of /usr to dte_t
The type /usr/local is also changed to dte_t
A node inherits its parent's type when its type is deleted. If the type inherited is different from its original type, it is treated as though the node's type has been changed.
The type of '/etc' is changed to 'generic_t' after its orignal type 'readable_t' is removed.
Notice that the flag '-r' cannot be removed for those nodes with children (i.e., directories) because directories differ from files by the existence of the flag '-r'. Users can add new nodes to a type graph by specifying its name, type and flag. Again new types can be created on-the-fly. There is no 'delete a node' operation availabe because deleting a node from a type graph in fact amounts to removing the node's type.