https://github.com/famousdraw

Neo4j Fundamentals-Graph Elements

Your work here is done!

Next: Graph Structure →

VIDEO

Graph Elements

VideoTranscript
 

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)

A diagram representing nodes and relationships

Nodes

Two nodes representing Michael and Sarah

Nodes (or vertices) are the circles in a graph. Nodes commonly represent objectsentities, 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

Two nodes representing Michael and Sarah and connected by a MARRIED_TO relationship

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.

Three nodes representing Michael

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 LocationPerson owns CarPerson 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.

posted on   红色MINI  阅读(93)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 【自荐】一款简洁、开源的在线白板工具 Drawnix
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
· Docker 太简单,K8s 太复杂?w7panel 让容器管理更轻松!

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

点击右上角即可分享
微信分享提示