View subgraphs¶
With the View Subgraphs function, you can run a FIND SHORTEST | ALL PATH or a GET SUBGRAPH
statement on the Console page and then view the result on the Explore page.
Studio version¶
Studio of v2.0.0 or later versions supports this function. To update the version, see Check updates.
Prerequisites¶
To use the View Subgraphs function, you must do a check of these:
- The version of Studio is v2.0.0 or later.
- Studio is connected to Nebula Graph v2.x.
- A dataset exists in the database. In the example of this article, the mooc_actions dataset is used. For more information, see Import data.
Procedure¶
To query the paths or subgraph on the Console page and then view them on the Explore page, follow these steps:
-
In the navigation bar, click the Console tab.
-
In the Current Graph Space dropdown list, choose a graph space name. In this example, mooc_actions is chosen.
-
In the input box, enter a
FIND SHORTEST PATH
,FIND ALL PATH
, orGET SUBGRAPH
statement and click Run .Here is an nGQL statement example.
// Run FIND ALL PATH nebula> FIND ALL PATH FROM "1","2","4","6","42" to "History of Ecology","Neurobiology" OVER action; // Run FIND SHORTEST PATH nebula> FIND SHORTEST PATH FROM "1","2","4","6","42" to "History of Ecology","Neurobiology" OVER action; // Run GET SUBGRAPH nebula> GET SUBGRAPH 1 STEPS FROM "1";
Take the
FIND ALL PATH
for example, the queried result gives all the paths from the specified user vertices to the course vertices, as shown in this figure. -
Click the View Subgraphs button.
-
(Optional) If some data exists on the board of Explore, choose a method to insert data:
- Incremental Insertion: Click this button to add the result to the existing data on the board.
- Insert After Clear: Click this button to clear the existing data from the board and then add the data to the board.
When the data is inserted, you can view the visualized representation of the paths.
Next to do¶
On the Explore page, you can expand the graph to explore and analyze graph data.