Graphs

We’ve started Dgraph, but first things first: What is a graph and what has that got to do with databases?

Graphs describe objects and the interconnections between them. Many people have heard of friendship graphs, or social network graphs, so let’s start there.

Note

OK, you’ll have to use your imagination here. We’re still building the tutorial, and we don’t have the visualizations up and running just yet. By starting Dgraph, you’ll have the visualization component working just fine. Very soon, that will be integrated with the tutorial. If you want the visualization, you’ll have to run it in another tab and cut and paste the queries across.

Press run the query to the right. (You’ll see the JSON output here. Run the same query in Dgraph UI and check the visualization too though.) In the resulting graph, circles denote people and pets, and lines denote connections or labeled relationships between them. See if you can find Michael and his pet sheep, Rammy.

Graphs lend themselves so naturally to visualization that you’ll find yourself thinking in terms of graphs and visualizations of them.

In a graph, the objects (or entities) are called nodes and the relationships are called edges or predicates.

Graphs aren’t just for social networks. Other examples include

  • Interconnected data, like SQL tables requiring joins
  • Advanced search
  • Recommendation engines
  • Pattern detection
  • Networks, like computers, roads, and telecommunications
  • Processes, like business and biological processes
  • Events and the causality or other links between them
  • Structures of firms or markets

These and the many more applications of graphs lead us to graph databases.

Endpoint: /query
Response