diff --git a/docs-2.0/1.introduction/2.1.path.md b/docs-2.0/1.introduction/2.1.path.md new file mode 100644 index 00000000000..fa84b61c64a --- /dev/null +++ b/docs-2.0/1.introduction/2.1.path.md @@ -0,0 +1,47 @@ +# Path types + +In graph theory, a path in a graph is a finite or infinite sequence of edges which joins a sequence of vertices. Paths are fundamental concepts of graph theory. + +Paths can be categorized into 3 types: `walk`, `trail`, and `path`. For more information, see [Wikipedia](https://en.wikipedia.org/wiki/Path_(graph_theory)#Walk,_trail,_path). + +The following picture is an example for a brief introduction. + +![path](../../images/path1.png) + +## walk + +A `walk` is a finite or infinite sequence of edges. Both vertices and edges can be repeatedly visited in graph traversal. + +In the above picture C, D, and E form a cycle. So, this picture contains infinite paths, such as `A->B->C->D->E`, `A->B->C->D->E->C`, and `A->B->C->D->E->C->D`. + +!!! note + + `GO` statements use `walk`. + +## trail + +A `trail` is a finite sequence of edges. Only vertices can be repeatedly visited in graph traversal. The Seven Bridges of Königsberg is a typical `trail`. + +In the above picture, edges cannot be repeatedly visited. So, this picture contains finite paths. The longest path in this picture consists of 5 edges: `A->B->C->D->E->C`. + +!!! note + + `MATCH`, `FIND PATH`, and `GET SUBGRAPH` statements use `trail`. + +There are two special cases of trail, `cycle`, and `circuit`. The following picture is an example for a brief introduction. + +![trail](../../images/Circuits1.png) + +- cycle + + A `cycle` refers to a closed `trail`. Only the terminal vertices can be repeatedly visited. The longest path in this picture consists of 3 edges: `A->B->C->A` or `C->D->E->C`. + +- circuit + + A `circuit` refers to a closed `trail`. Edges cannot be repeatedly visited in graph traversal. Apart from the terminal vertices, other vertices can also be repeatedly visited. The longest path in this picture: `A->B->C->D->E->C->A`. + +## path + +A `path` is a finite sequence of edges. Neither vertices nor edges can be repeatedly visited in graph traversal. + +So, the above picture contains finite paths. The longest path in this picture consists of 4 edges: `A->B->C->D->E`. diff --git a/docs-2.0/1.introduction/2.data-model.md b/docs-2.0/1.introduction/2.data-model.md index 311f9a8898e..a53fb40363e 100644 --- a/docs-2.0/1.introduction/2.data-model.md +++ b/docs-2.0/1.introduction/2.data-model.md @@ -8,7 +8,7 @@ Nebula Graph data model uses six data structures to store data. They are graph s - **Graph spaces**: Graph spaces are used to isolate data from different teams or programs. Data stored in different graph spaces are securely isolated. Storage replications, privileges, and partitions can be assigned. - **Vertices**: Vertices are used to store entities. - - In Nebula Graph, vertices are identified with vertex identifiers (i.e. `VID`). The `VID` must be unique in the same graph space. VID should be int64, or fixed_string(N)。 + - In Nebula Graph, vertices are identified with vertex identifiers (i.e. `VID`). The `VID` must be unique in the same graph space. VID should be int64, or fixed_string(N). - A vertex must have at least one tag or multiple tags. - **Edges**: Edges are used to connect vertices. An edge is a connection or behavior between two vertices. - There can be multiple edges between two vertices. diff --git a/docs-2.0/20.appendix/Circuits.png b/docs-2.0/20.appendix/Circuits.png new file mode 100644 index 00000000000..a813f6cd390 Binary files /dev/null and b/docs-2.0/20.appendix/Circuits.png differ diff --git a/docs-2.0/20.appendix/path.png b/docs-2.0/20.appendix/path.png new file mode 100644 index 00000000000..023d67f0747 Binary files /dev/null and b/docs-2.0/20.appendix/path.png differ