DBA

# Graph Databases – Introduction

I have been looking into this feature and also into understanding graph data in general. I believe introduction of graph database feature in SQL Server has many advantages – although I also believe it is important to understand the background/origin/ and how it was done before. In this series I will start with the history and cover several ways it was done before we got to where we are now.

Origins of Graph Theory: The theory behind graph data is old and goes back what is popularly known as Konigsberg Bridge Problem. The problem has been narrated several times – in short it was about how to traverse a town with 4 land masses (2, but 4 if you include two banks of a river) connected by 7 bridges. A mathematician named Leonard Euler took it up and came up with a mathematical concept of ‘nodes'(land masses) ,’edges’ (the connections between nodes or bridges), and the number of ‘edges’ coming out of each node (degrees). Euler’s theory, put very simply, says if you have more than two nodes with odd degrees in a configuration then you cannot traverse the graph from one end to another. This laid the foundation for graph data and what we have now.

How is it different from relational data? : Every thing we do with graph data modeling and querying can be done in the relational world. But to classify data as graph data it has to be a certain way. Graph data has way more relationships than it does entities. I like to use the simple example of social media followers. I am an entity, for example, with 100 followers. My friend has 200 followers. Between us we have 50 friends in common. Those friends in turn have friends in common with me. And so on. If you have to model this in the relational world, the number of relationships will be too large and difficult to represent, let alone query on. This is the kind of problem that graph data modeling and querying helps us model and deal with.

What are some common examples of graph data? Graph data is all around us…some of the most common examples are Chart of Accounts, Organizational Charts, Transportation Systems (GPS), Bill of Materials and social media connections.

In the next post I can discuss some examples of data modeling with graph data, and what are the specific problems/algorithms we can solve by modeling it this way.

This site uses Akismet to reduce spam. Learn how your comment data is processed.