Neo4j Fundamentals-Graph Elements
Your work here is done!
VIDEO
Graph Elements
Graph elements
Let’s take a closer look at the two elements that make up a graph:
-
Nodes (also known as vertices)
-
Relationships (also known as edges)

Nodes

Nodes (or vertices) are the circles in a graph. Nodes commonly represent objects, entities, or merely things.
In the Seven Bridges of Königsberg example in the previous lesson, nodes were used to represent the land masses.
Another example that everyone can relate to is the concept of a social graph. People interact with each other and form relationships of varying strengths.
The diagram to the right has two nodes which represent two people, Michael and Sarah. On their own, these elements are uninspiring. But when we start to connect these circles together, things start to get interesting.
Nodes typically represent things
Examples of entities that could typically be represented as a node are: person, product, event, book or subway station.
Relationships

Relationships (or edges) are used to connect nodes. We can use relationships to describe how nodes are connected to each other. For example Michael has the WORKS_AT relationship to Graph Inc because he works there. Michael has the MARRIED_TO relationship to Sarah because he is married to her.
All of a sudden, we know that we are looking at the beginnings of some sort of social graph.
Now, let’s introduce a third person, Hans, to our Graph.

Hans also works for Graph Inc along with Michael. Depending on the size of the company and the properties of the relationship, we may be able to infer that Michael and Hans know each other.
If that is the case, how likely is it that Sarah and Hans know each other?
These are all questions that can be answered using a graph.
Relationships are typically verbs.
We could use a relationship to represent a personal or professional connection (Person knows Person, Person married to Person), to state a fact (Person lives in Location, Person owns Car, Person rated Movie), or even to represent a hierarchy (Parent parent of Child, Software depends on Library).
Check your understanding
1. Nodes or relationships?
Say we wanted to add additional data to our graph to detail that Michael lives in London, which element would best represent that location?
-
✓ Node
-
Relationship
Summary
In this lesson you learned about nodes (vertices) and relationships (edges) that make up a graph. Next, you will learn about graph structure where relationships may have direction or weights.
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!