5.9.5. Working with Selections and the Marking

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

A selection is a subset of elements of one view and therefore specific to a view. The elements of a selection are highlighted blue.

The marking is a graph global subset of elements. The members of the marking are highlighted red.

Note

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

Figures Example of selections of nodes and edges in multiple views. and Example of a marking of nodes and edges in multiple views. show 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..

A selection is used for manipulation and query operations. 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

The manual way of selecting elements is the selecttool1 Select Tool. While this tool is active, clicking on an element clears the selection and selects the clicked element. Holding down Ctrl keeps the existing selection and toggles the selection state of the clicked element, i. e., selects it if it was unselected, and deselects it if it was selected. Holding down Shift while clicking on a node also selects all its direct and indirect children (“deep selection”).

Dragging a box around several elements clears the selection and selects the enclosed elements in one go. Shift has the same meaning as for clicks and causes deep selection. Holding down Ctrl keeps the selection and toggles the selection state of all the enclosed objects as follows: If all of them were already selected, they are deselected. If none or just some of them were already selected, they are all selected.

Graph Structure Based Selection

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

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

  • ic_select_attached_edges Attached edges. Selects all edges whose source or target nodes are already in the selection.

  • ic_select_incoming_edges Incoming edges. Selects all edges whose target nodes are already in the selection.

  • ic_select_outgoing_edges Outgoing edges. Selects all edges whose source nodes are already in the selection.

  • ic_select_connecting_edges Connecting edges. Selects all edges whose source and target nodes are already in the selection.

  • ic_select_ancestors Ancestors. Selects the parents of selected nodes, the parents of the parents, etc.

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

  • ic_select_backward_closure Backward closure. Selects the source nodes of all incoming edges of the selected nodes and repeats this until no more nodes are added to the selection. This selects all nodes from which a selected node can be reached by a directed edge path. For instance, in a Call view, this represents all routines from which the selected routines can be directly or indirectly (transitively) called.

  • ic_select_forward_closure Forward closure. Selects the target nodes of all outgoing edges of the selected nodes and repeats this until no more nodes are added to the selection. This selects all nodes that can be reached from a selected node by a directed edge path. For instance, in a Call view, this represents all routines that the selected routines can directly or indirectly (transitively) call.

  • ic_select_two_way_closure Two-way closure. Selects the source nodes of all incoming edges and all target nodes of all outgoing edges of the selected nodes and repeats this until no more nodes are added to the selection. This selects all nodes that can be reached from a selected node by an edge path ignoring edge direction, i. e., all nodes that are directly or indirectly connected with a selected node.

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

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

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

  • ic_select_target_nodes Target nodes. Select 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. The universe for this operation is the view.

  • ic_clip_selection_to_visible Clip selection to visible elements. ’Visible’ elements are elements that can potentially be made visible by zoom and scroll operations in the current graph window.

  • ic_select_by_query Select by query.... Opens a dialog in which a property-based selection condition can be set up, see Section Query-based operations.

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

5.9.5.2. Marking Elements

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

Operation ic_mark Markic_clip_marking_to_view Clip marking to view only keeps those elements in the marking that are in the current view.

The operation ic_select Selectic_select_marking Select marking and ic_mark Markic_mark_selection Mark selection allow to select the marking and mark the selection.

5.9.5.3. Query-based operations

The query mechanism allows 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.

The facility is explained using selection as an example:

The select by query facility allows to specify which types of elements shall be selected and which predicates based on attribute values must hold for newly selected elements in addition. The dialog is opened by ic_select Selectic_select_by_query Select by query... from the context menu of the graph View Box or the context menu of a graph window.

:guielement:`Select by query` dialog.

Select by query dialog.

The Nodes and Edges tabs allow you to specify the conditions for nodes and edges. Both tabs are active at the same time, so you can select nodes and edges using a single operation. By default, the tabs are set up in a way that nothing gets selected, so if you just want to select nodes, you need not worry about the Edges tab.

In the type tree, the types of elements to be selected are checked. If a parent type is checked, the children are checked as well but this behavior can be overridden by unchecking individual child types afterwards.

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

Below the type tree, additional predicates for attribute values can be added. Choosing an attribute name activates a predicate row. Depending on the type of attribute, different comparison operations are available. The value to compare against can be entered as the last item in the predicate row. For string attribute comparisons, it is also possible to select whether the comparison should be case insensitive ( a=A). The special operators set and unset on the operator menu test whether the given attribute is present/absent from the element.

As soon as a predicate gets activated, a new empty predicate row shows up at the bottom. Predicate rows that are no longer needed can be removed using the trash can icon to the right.

The most recently used query is remembered and can be recalled using the Recall previous button, e.g., to repeat the query or to refine it.

The Select by query and Mark by query dialogs also show an additional button labeled Clear selection (or Clear marking respectively) that can be used to clear the selection/marking before applying the query.

Pseudo-attributes for structural matching

If the Query window was opened from the context menu of a view entry in the View Box or from the context menu of a window showing a view, then a new entry Pseudo attributes with a few extra 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 are pseudo node attributes that are not stored in the graph but computed based on the graph structure. They are computed for the given context view.

Caution

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