失效链接处理 |
ArangoDB-GraphCourse_Beginners PDF 下载
本站整理下载:
提取码:4tgh
相关截图:
主要内容:
Graph Basics
What is a graph? There are multiple definitions and types. A brief overview:
In discrete mathematics, a graph is defined as set of vertices and edges.
In computing it is considered an abstract data type which is really good to
represent connections or relations – unlike the tabular data structures of
relational database systems, which are ironically very limited in expressing
relations.
A good metaphor for graphs is to think of nodes as circles and edges as
lines or arcs. The terms node and vertex are used interchangeably here.
Usually vertices are connected by edges, making up a graph. Vertices don't
have to be connected, but they may also be connected with more than
one other vertex via multiple edges. You may also find vertices connected
to themselves.
7
Vertex
Edge
Graph Basics
Important types of graphs:
‣ Undirected – edges connect pairs of nodes without
having a notion of direction
‣ Directed – edges have a direction associated with them
(the lines/arcs have arrow heads in depictions)
‣ DAG – Directed Acyclic Graph: edges have a direction and
their are no loops. In the most simple case, this means
that if you have vertices A and B and an edge from A to
B, then there must not be another edge from B to A.
One example for a DAG is a tree topology.
8
Graph Basics
In ArangoDB, each edge has a single direction, it can't point
both ways at once. This model is also known as oriented graph.
Moreover, edges are always directed, but you can ignore the
direction (follow in ANY direction) when you walk through the
graph, or follow edges in reverse direction (INBOUND) instead
of going in the direction they actually point to (OUTBOUND).
Walking through a graph is called traversal.
ArangoDB allows you to store all kinds of graphs in different
shapes and sizes, with and without cycles. You can save one
or more edges between two vertices or even the same vertex.
Also note that edges are full-fledged JSON documents,
which means you can store as much information on the edges
as you want!
9
OUTBOUND INBOUND
ANY
Graph Basics
A few examples what can be answered by graph queries with the example dataset in mind:
‣ Give me all flights departing from JFK (airport in New York)
‣ Give me all flights landing in LAX (airport in Los Angeles) on January 5th
‣ Which airports can I reach with up to one stopover?
(From one or multiple starting airports)
‣ Shortest Path:
‣ What is the minimum amount of stopovers to fly from BIS
(Bismarck Municipal Airport in North Dakota) to LAX and where is the stopover?
‣ Pattern Matching:
‣ Departing from BIS, which flight to JFK with one stopover
(at least 20 minutes time for the transit) is the quickest and via which airport?
10
|