Skip to content

Commit c49e24f

Browse files
Simran-Bnerpaula
andauthored
DOC-769 | Graph Visualizer Canvas Actions and UI updates (#734)
* Update for UI changes * Add Canvas Actions * Fix links * fix typo --------- Co-authored-by: Paula Mihu <97217318+nerpaula@users.noreply.github.com>
1 parent 4cacd89 commit c49e24f

File tree

1 file changed

+61
-25
lines changed

1 file changed

+61
-25
lines changed

site/content/3.13/graphs/graph-visualizer.md

Lines changed: 61 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -55,68 +55,104 @@ The main area of the viewport may initially be empty in the following cases:
5555
- Reopening the Graph Visualizer after a previous session
5656
-->
5757

58-
You can [Add nodes to the canvas](#add-nodes-to-the-canvas) as well as
59-
[Display a subgraph using a query](#display-a-subgraph-using-a-query).
58+
You can [Add nodes to the canvas manually](#add-nodes-to-the-canvas-manually)
59+
as well as [Add nodes and edges using a query](#add-nodes-and-edges-using-a-query).
60+
Afterwards, you can also [Add nodes and edges using a query based on a selection](#add-nodes-and-edges-using-a-query-based-on-a-selection).
6061

6162
### The viewport
6263

6364
The Graph Visualizer interface is comprised of the following components:
6465

6566
- **Canvas**: The main area of the viewport.
66-
- **Explore**:
67-
A widget in the top left corner that opens a dialog for selecting nodes and
68-
edges to display.
67+
- **Search & add nodes to canvas** and **Queries**:
68+
A widget in the top left corner that opens dialogs for selecting nodes and
69+
edges to display (manually or using queries).
6970
- [**Customization**](#visual-customization):
7071
A sidebar on the right-hand side to adjust the styling.
7172
- [**Layout and Navigation**](#layouts-and-navigation-tools):
7273
A minimap and multiple tools for the canvas in the bottom right corner.
7374

74-
### Add nodes to the canvas
75+
### Add nodes to the canvas manually
7576

7677
You can add individual nodes to the canvas in addition to what is already
7778
displayed.
7879

79-
1. Click **Explore**.
80-
2. On the **Search** tab, select a **Vertex type**. This is the name of the
81-
collection that stores the node you want to select.
82-
3. Enter a value into the **Search** field. <!-- TODO: Which attributes?! -->
80+
1. Click **Search & add nodes to canvas**.
81+
2. Select a **Node type**. This is the name of the collection that stores the
82+
node you want to select.
83+
3. Enter a value into the **Search** field. This searches common attributes
84+
as indicated by the placeholder text and finds up to 10 nodes that contain
85+
this text in one of these attributes (case-insensitive).
8386
4. Select one or more nodes from the list on the left-hand side.
8487
5. Optional: You can check the attributes of the selected nodes on the
8588
right-hand side. Use the buttons at the bottom to switch between nodes.
8689
6. Click **Add _n_ vertices**.
8790
7. To see the neighbor nodes and the edges that connect them, right-click a node,
88-
click **Expand (_n_)** and then **All (_n_)**. <!-- TODO: What other options exist? -->
91+
click **Expand (_n_)** and then **All (_n_)**.
8992

90-
### Display a subgraph using a query
93+
### Add nodes and edges using a query
9194

92-
You can run an AQL query to view a subset of the graph.
93-
It replaces the current content of the canvas.
95+
You can run an AQL query to add a nodes, edges, or paths of the graph to the canvas.
9496

95-
1. Click **Explore**.
96-
2. On the **New query** tab, enter an AQL query that returns edges or paths
97+
1. Click **Queries** of the top-left widget.
98+
2. Click **New query**.
99+
3. Enter an AQL query that returns nodes, edges, or paths
97100
(e.g. a graph traversal query), for example:
98101
```aql
99-
FOR edge IN edgeColl FILTER edge.value > 10 RETURN edge
102+
FOR node IN coll LIMIT 10 RETURN node // [ { "_id": "..." }, ... ]
100103
```
101104
```aql
102-
FOR v, e, p IN 1..3 ANY "coll/753" GRAPH "myGraph" RETURN p
105+
FOR edge IN edgeColl FILTER edge.value > 10 RETURN edge // [ { "_from": "...", "_to": "...", "_id": "..." }, ... ]
103106
```
104-
3. The edges and their nodes appear on the canvas.
107+
```aql
108+
FOR v, e, p IN 1..3 ANY "coll/753" GRAPH "myGraph" RETURN p // [ { "vertices": [...], "edges": [...] }, ... ]
109+
```
110+
4. Click **Run query**. Depending on what the query returns, either only nodes
111+
or edges with their nodes appear on the canvas, in addition to what is
112+
already displayed.
105113

106114
{{< tip >}}
107115
You can save queries for future use:
108116

109-
1. Click **Explore**.
110-
2. On the **New query** tab, click **Save as**, enter a name and optionally a
111-
description, then click **Save**.
112-
3. To run a saved query, click **Explore**.
113-
4. On the **Saved Queries** tab, you can see a list of saved queries, and the
114-
following actions are available for each:
117+
1. Click **Queries** of the top-left widget.
118+
2. Click **New query**.
119+
3. Enter or edit the AQL query you want to save. You can optionally use
120+
bind variables to parameterize saved queries.
121+
4. Enter a name and optionally a description, then click **Save**.
122+
5. To run a saved query, click **Queries** of the top-left widget.
123+
6. Select a query from the list. The following actions are available for each query:
124+
- **Bind Variables** to set for the query.
115125
- **Run** the query.
116126
- **Copy** the query string to the clipboard.
117127
- **Delete** a no longer needed query.
118128
{{< /tip >}}
119129

130+
### Add nodes and edges using a query based on a selection
131+
132+
You can select nodes and edges on the canvas and then use a **Canvas Action**.
133+
This runs an AQL query to add nodes, edges, or paths of the graph to the canvas.
134+
The query has access to the current selection via special bind variables.
135+
136+
1. Create a selection. You have different options:
137+
- Click a node or edge to select only this element.
138+
- Hold the **Shift** or **Ctrl** key and click multiple nodes and edges.
139+
- Hold the **Shift** or **Ctrl** key and drag the mouse to perform a box selection.
140+
2. Right-click the canvas, click **Canvas Action**, and select a saved action.
141+
3. Depending on the query, additional nodes or edges with their nodes are added
142+
to the canvas.
143+
4. To create a custom Canvas Action query, click **Queries** of the top-left widget.
144+
5. Click **Canvas Actions**, then **New action**.
145+
6. Enter an AQL query that makes use of the special bind variable `@nodes`,
146+
`@edges`, or both and returns nodes, edges, or paths. Examples:
147+
```aql
148+
FOR selectedNode IN @nodes
149+
FOR v, e, p IN 1..3 ANY selectedNode GRAPH "myGraph"
150+
FILTER p.edges[*].value ALL < 7
151+
LIMIT 20
152+
RETURN p
153+
```
154+
7. Enter a name and optionally a description for the action and click **Save**.
155+
120156
### View node and edge properties
121157

122158
You can inspect the document attributes of node or edge as follows:

0 commit comments

Comments
 (0)