Skip to content

Commit

Permalink
Introduction (#524)
Browse files Browse the repository at this point in the history
* what-is-nebula-graph

* Address Wum's Comments

* data-model
  • Loading branch information
izhuxiaoqing authored Jun 23, 2021
1 parent 841313c commit deb784c
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions docs-2.0/1.introduction/2.data-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,29 @@ A data model is a model that organizes data and specifies how they are related t

## Data structures

Nebula Graph data model uses five data structures to store data. They are vertices, edges, properties, tags, and edge types.
Nebula Graph data model uses six data structures to store data. They are spaces, vertices, edges, properties, tags, and edge types.

- **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.
- A vertex must have at least one tag.
- 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.
- An edge is identified uniquely with a source vertex, an edge type, a rank value, and a destination vertex.
- There can be multiple edges between two vertices.
- Edges are directed. `->` identifies the directions of edges. Edges can be traversed in either direction.
- An edge is identified uniquely with a source vertex, an edge type, a rank value, and a destination vertex. Edges have no EID.
- An edge must have one and only one edge type.
- The rank value is an immutable user-assigned 64-bit signed integer. It identifies the edges with the same edge type between two vertices. Edges are sorted by their rank values. The edge with the greatest rank value is listed first. The default rank value is zero.
- **Properties**: Properties are key-value pairs. Both vertices and edges are containers for properties.
- **Tags**: Tags are used to categorize vertices. Vertices that have the same tag share the same definition of properties.
- **Edge types**: Edge types are used to categorize edges. Edges that have the same edge type share the same definition of properties.
- **Properties**: Properties are key-value pairs. Both vertices and edges are containers for properties.

!!! Note

Tag and Edge type are similar to the vertex graph and edge graph in the relational databases.

## Directed property graph

Nebula Graph stores data in directed property graphs. A directed property graph has a set of vertices connected by edges. And the edges have directions. A directed property graph is represented as:
Nebula Graph stores data in directed property graphs. A directed property graph has a set of vertices connected by directed edges. Both vertices and edges can have properties. A directed property graph is represented as:

**G = < V, E, P<sub>V</sub>, P<sub>E</sub> >**

Expand All @@ -29,11 +35,15 @@ Nebula Graph stores data in directed property graphs. A directed property graph
- **P<sub>V</sub>** is the property of vertices.
- **P<sub>E</sub>** is the property of edges.

The following table is an example of the structure of the basketball player dataset. We have two types of vertices, that is **player** and **team**, and two types of edges, that is **_serve_** and **_like_**.
The following table is an example of the structure of the basketball player dataset. We have two types of vertices, that is **player** and **team**, and two types of edges, that is **_serve_** and **_follow_**.

| Element | Name | Property name (Data type) | Description |
| :--- | :--- | :--- | :--- |
| Tag | **player** | name (string) <br> age (int) | Represents players in the team. |
| Tag | **team** | name (string) | Represents the teams.
| Edge type | **serve** | start_year (int) <br /> end_year (int) | Represents actions taken by players in the team. An action links a player and a team and the direction is from a player to a team. |
| Edge type | **like** | likeness (int) | Represents actions taken by players in the team. An action links a player and another player and the direction is from one player to the other player. |
| Edge type | **serve** | start_year (int) <br /> end_year (int) | Represents actions taken by players in the team. An action links a player with a team, and the direction is from a player to a team. |
| Edge type | **follow** | degree (int) | Represents actions taken by players in the team. An action links a player with another player, and the direction is from one player to the other player. |

!!! Note

Nebula Graph supports only directed edges.

0 comments on commit deb784c

Please sign in to comment.