DEV Community

Khai J. Thani
Khai J. Thani

Posted on • Edited on

2 1

Neo4j basics

What is a graph?

A graph is a set of objects in which some pairs of the objects are connected. The objects are known as nodes and the connections are known as relationships. With these two elements, we can solve real-world problems by creating or inferring connections between objects. We can also create predictions given the strength of the connections.

A set of connected circles

How are graphs structured?

In an undirected graph, the relationships are bi-directional or symmetric; in a directed graph, the relationships have one direction.

Undirected graph vs directed graph

In a weighted graph, the relationships carry measurable values such as cost, time, distance or priority.

Weighted graph

The structure of a graph enables traversal. The process consists of following the relationships. With Neo4j's Cypher query language, relationships are not be followed multiple times.

Some common use-cases for graphs

  • E-commerce and real-time recommendations:
    Recommendations like "People who bought {Product X} also bought…" can be generated by having a proportion of the graph be traversed. In this example, you traverse from one Product node to the Persons nodes who have purchased that product and then to the subsequent Products nodes that they have bought.

  • Investigative journalism:
    The graph known as Panana Papers was created to identify possible corruption based upon the relationships between people, companies, and most importantly financial institutions.

  • Network and IT operations:
    A typical graph would describe how information flows through a system and how components of a network are related

  • Transportation and logistics:
    A typical graph would describe how locations are related and the distances between them

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay