A graph is a representation of interconnected objects. An object is represented as a vertex (for example, cities, computers, and people). A link connecting two vertices is called an edge. Edges can represent roads that connect cities, computer network cables, interpersonal connections (such as co-worker relationships), and so on.
Graph example
In an Aster instance, to process graphs using SQL-GR, it is recommended that you represent a graph using two tables:
- Vertices table
- Edges table
The following two tables represent the example graph is shown in the preceding figure.
In the following table, each row represents a vertex.
Vertex | City Name |
---|---|
A | Albany |
B | Berkeley |
C | Cerrito |
D | Danville |
E | East Palo Alto |
F | Foster City |
G | Gilroy |
In the following table, each row represents an edge.
Source | Destination |
---|---|
A | B |
A | C |
A | E |
B | D |
C | D |
C | F |
C | G |
E | C |