5.9.5. Working with Selections and the Marking

There are two mechanisms for working with multiple graph elements at the same time: selections and the marking.

A selection is a subset of elements within a single view and is therefore specific to that view. Selected elements are highlighted in blue.

The marking is a graph-global subset of elements. Marked elements are highlighted in red.

Note

There is only one marking, whereas there are as many selections as there are views (a selection for a view can, of course, be empty).

Figures Example of selections of nodes and edges in multiple views. and Example of a marking of nodes and edges in multiple views. illustrate the difference between selections and the marking.

Example of selections of nodes and edges in multiple views.

Example of selections of nodes and edges in multiple views.

Example of a marking of nodes and edges in multiple views.

Example of a marking of nodes and edges in multiple views.

The graph View Box shows the count of selected elements per view. The marked elements are also counted per view. See Figure View Box showing the marking and selections..

Selections are used for manipulation and query operations, while the marking is used for transferring results between views and for cross-view querying.

View Box showing the marking and selections.

View Box showing the marking and selections.

5.9.5.1. Selecting Elements

Elements can be selected manually using the selecttool1 Select Tool. While this tool is active, clicking an element clears the current selection and selects the clicked element. Holding Ctrl preserves the existing selection and toggles the selection state of the clicked element (i.e., it selects the element if it was unselected, and deselects it if it was selected). Holding Shift while clicking a node also selects all its direct and indirect children (a “deep selection”).

Dragging a selection box around several elements clears the current selection and selects all enclosed elements. Holding Shift during this operation performs a deep selection, as with individual clicks. Holding Ctrl preserves the selection and toggles the selection state of all enclosed objects as follows: if all of them were already selected, they are deselected; if none or only some of them were already selected, they are all selected.

Graph Structure Based Selection

The following selection operations are available in the context menu of a view in the graph View Box, a graphical window, or a tree window.

If at least one node is selected, the ic_select Select submenu allows the additional selection of:

  • ic_select_attached_edges Select attached edges. Selects all edges whose source or target nodes are already selected.

  • ic_select_incoming_edges Select incoming edges. Selects all edges whose target nodes are already selected.

  • ic_select_outgoing_edges Select outgoing edges. Selects all edges whose source nodes are already selected.

  • ic_select_connecting_edges Select connecting edges. Selects all edges whose source and target nodes are already selected.

  • ic_select_ancestors Select ancestors. Selects the parents of selected nodes, their parents, and so on.

  • ic_select_children Select children. Selects the immediate children of selected nodes.

  • ic_select_backward_closure Select backward closure. Selects the source nodes of all incoming edges of the selected nodes, repeating this process until no further nodes are added. This selects all nodes from which a selected node can be reached via a directed edge path. For example, in a Call view, this represents all routines that can directly or indirectly (transitively) call the selected routines.

  • ic_select_forward_closure Select forward closure. Selects the target nodes of all outgoing edges of the selected nodes, repeating this process until no further nodes are added. This selects all nodes reachable from a selected node via a directed edge path. For example, in a Call view, this represents all routines that the selected routines can directly or indirectly (transitively) call.

  • ic_select_two_way_closure Select two-way closure. Selects the source nodes of all incoming edges and the target nodes of all outgoing edges of the selected nodes, repeating this process until no further nodes are added. This selects all nodes reachable from a selected node via an undirected edge path (ignoring edge direction), i.e., all nodes directly or indirectly connected to a selected node.

If at least one edge is selected, the ic_select Select submenu allows the additional selection of:

  • ic_select_attached_nodes Select attached nodes. Selects all source and target nodes of the selected edges.

  • ic_select_source_nodes Select source nodes. Selects all source nodes of the selected edges.

  • ic_select_target_nodes Select target nodes. Selects all target nodes of the selected edges.

General Selection Operations

The following general selection operations are available from the ic_select Select submenu:

  • ic_select_all Select all elements in a view.

  • ic_deselect_all Deselect all elements.

  • ic_deselect_nodes Deselect nodes.

  • ic_deselect_edges Deselect edges.

  • ic_select_root_nodes Select top-level nodes.

  • ic_invert_selection Invert selection. Inverts the selection. The scope of this operation is the current view.

  • ic_clip_selection_to_visible Clip selection to visible elements. “Visible” elements are those that can potentially be made visible by zooming or scrolling in the current graph window.

  • ic_select_by_query Select by query.... Opens a dialog to define a property-based selection condition; see Section Query-based operations.

  • ic_deselect_by_query Deselect by query.... Functions as above, but for deselecting objects.

5.9.5.2. Marking Elements

The marking is operated similarly to the selection; the marktool1 Mark Tool is used for manual marking.

The operation ic_mark Mark → ic_clip_marking_to_view Clip marking to view keeps only those elements in the marking that are present in the current view.

The operations ic_select Select → ic_select_marking Select marking and ic_mark Mark → ic_mark_selection Mark selection allow users to select the marking or mark the current selection.

5.9.5.3. Query-based operations

The query mechanism allows users to ic_select_by_query Select by query, ic_deselect_by_query Deselect by query, ic_mark_by_query Mark by query, ic_unmark_by_query Unmark by query, ic_hide_by_query Hide by query, and ic_show_by_query Unhide by query.

This feature is explained using selection as an example:

The “Select by Query” feature allows you to specify which types of elements should be selected and which attribute-based predicates must hold for the newly selected elements. Open the dialog via ic_select Select → ic_select_by_query Select by query... from the context menu of the graph View Box or from the context menu of a graph window.

:guielement:`Select by query` dialog.

Select by query dialog.

The Nodes and Edges tabs are used to specify the conditions for nodes and edges. Both tabs are active simultaneously, allowing you to select nodes and edges in a single operation. By default, the tabs are configured so that nothing is selected; therefore, if you only want to select nodes, you can ignore the Edges tab.

In the type tree, check the types of elements you wish to select. If a parent type is checked, its children are also checked; however, this behavior can be overridden by unchecking individual child types.

Buttons are provided to check all types, uncheck all types, and invert the check pattern, as well as to expand and collapse the type hierarchy tree.

Additional predicates for attribute values can be added below the type tree. Selecting an attribute name activates a predicate row. Each attribute type has its own specific set of available comparison operations. The comparison value can be entered as the last item in the predicate row. For string attribute comparisons, you can specify whether the comparison should be case-insensitive (a=A). The special operators set and unset in the operator menu test whether the specified attribute is present or absent from the element.

Once a predicate is activated, a new empty predicate row appears at the bottom. Unnecessary predicate rows can be removed using the trash can icon on the right.

The And and Or radio buttons below the predicate rows determine whether an element must satisfy all predicates (the default) or at least one of them. In both cases, the element must also be one of the checked types.

The most recently used query is saved and can be recalled using the Recall previous button to repeat or refine the query.

The Select by query and Mark by query dialogs include a button labeled Clear selection (or Clear marking, respectively) to clear the current selection or marking before applying the query.

Pseudo-attributes for structural matching

If the Query window is opened from the context menu of a view entry in the View Box or from the context menu of a window displaying a view, a new Pseudo attributes entry with additional attributes appears in the attributes menu of the Nodes tab. The following attributes can be used in attribute queries for nodes:

  • Number of incoming edges

  • Number of outgoing edges

  • Number of attached edges

These pseudo node attributes are not stored in the graph but are computed based on the graph structure for the current context view.

Caution

The computed edge counts always include all edges present in the view, including those that are currently hidden or belong to hidden types. They also include hierarchical edges (e.g., of type Part_Of and Enclosing) that are not displayed as edges in hierarchical diagrams.