{"id":49358,"date":"2016-01-25T00:00:00","date_gmt":"2016-01-25T00:00:00","guid":{"rendered":"https:\/\/www.techopedia.com\/how-graph-databases-bring-networking-to-data\/"},"modified":"2020-06-25T20:11:54","modified_gmt":"2020-06-25T20:11:54","slug":"how-graph-databases-bring-networking-to-data","status":"publish","type":"post","link":"https:\/\/www.techopedia.com\/2\/31571\/trends\/big-data\/how-graph-databases-bring-networking-to-data","title":{"rendered":"How Graph Databases Bring Networking to Data"},"content":{"rendered":"
Modern-day data-driven applications are largely dependent on relevant insights derived from the enormous volumes of data they handle every day. To gain better insights every time, the applications need to be able to send complex queries<\/a> and the database should be able to address complex queries. Traditional RDBMS<\/a> systems that rely on SQL<\/a> are unable to handle extremely complex queries. Graph databases<\/a> have been able to solve this problem because they rely on objects and the relationships between objects. Based on this premise, it is possible to extract deep insights. The use of graph databases, however, is still limited, although there are definite signs that it is going to play an important role as businesses rely more and more on insights to power their business. (For more on databases in general, see Introduction to Databases<\/a>.)<\/p>\n To understand graph databases, let us use the example below:<\/p>\n Bill and his family want to plan a vacation to a place that offers great Asian cuisine. He has started planning early and one of the ways to find information is, of course, Google. While the information from Google is credible and good, for Bill, it is important to get as specific information as possible. So, he starts asking his friends, acquaintances and colleagues. Let us assume that Bill asks Ryan, Sheena and John, who are his primary contacts (contact level 1). All three promise to respond with information as soon as possible. Ryan asks his friend Greg, who asks his cousin Martin who has been to Bangkok a few times. Martin recommends the names and details of all his favorite eateries in Bangkok known for their Asian dishes. This information is relayed back to Bill.<\/p>\n You have just seen a real-life example of a complex query based on objects and relationships. The graph database works on the same principle. It is about the network, the objects and their relationships in the network.<\/p>\n Basically, a graph database is capable of extremely complex graphs and provides insights which SQL-query-based RDBMS systems cannot. And that is the unique selling point about graph databases.<\/p>\n The above description of a graph database gives some idea about the principles that a graph database applies when it searches for information or insights. Basically, it traverses the network of objects and relationships based on the query, and returns the results.<\/p>\n If we take the above example of Bill, then how would a graph database go about its job? Obviously, there are a lot of relationships and nodes<\/a> in the example. If we see the distance of the relationships, it would look like the following:<\/p>\n Bill = 0 (the origin)<\/p>\n Ryan = 1<\/p>\n Sheena = 1<\/p>\n John = 1<\/p>\n Greg = 2<\/p>\n Martin = 3<\/p>\n The distance between the origin (zero) and the node that provides the information could be even further in real life — that is how the network works.<\/p>\n Imagine an application sending a query based on Bill’s requirement. It would be something like:<\/p>\n Find all friends who are connected with five friends who like Asian food, who have visited Thailand and who live within 5 miles of Dallas.<\/em><\/p>\n There are a lot of graph databases available in the market, and Neo4j is the most popular among them. Neo4j can attribute its popularity to the facts that it is both efficient and open source<\/a>. So, when you send a query to the Neo4j to solve Bill’s problem, the query could look something like:<\/p>\n \/\/ select friends and friends of friends, keyword of Asian food, keyword of Bangkok, order by depth of the relationship<\/em><\/p>\n String findFriendsQuery = "start n=node(*), person=node({userNode}) MATCH p = (person)-[:FRIEND*1..2]-(friend) return distinct p order by length(p)";<\/em><\/p>\n Based on the query, Neo4j is going to search through its available network and find the closest matches.<\/p>\n The main point around which relational databases and graph databases are compared is the speed of transactions, that is, how fast can it process a complex query on a big data set<\/a>.<\/p>\n Emil Eifrem, the CEO of Neo Technology, the company behind Neo4j, measured the performance of both relational and graph databases on multiple parameters. The query was: in 1,000 users with each user having 50 friends or more, find out if one user is connected to another in 4 or fewer hops. The results are given below:<\/p>\n The main reason the relational database was taking such a long time to process queries was that it was searching the data for every term provided in the query. No wonder that it was taking such a long time! On a bigger database, it would take even longer. The graph database, on the other hand, would only look at records that are directly connected to the records in the database. If the graph database is allowed a specific number of hops, then it would stick to that precisely. That was the reason a graph database was able to process complex queries on huge data sets relatively easily and achieve faster results. (To learn more about working with databases, see Database Administration Careers 101<\/a>.)<\/p>\n There have been many successful applications of graph databases in different industries. Big companies have led the way in building their world-class products with the graph database principles. Initially it was thought that since it was about nodes and relationships, certain industries like social media<\/a> could benefit from this. However, other sectors such as online dating, manufacturing and online job portals have also benefited from it. Given below are a few examples:<\/p>\n For all the potential of graph databases, a lot of companies are still playing catch-up with the trend. So, it will be a while before graph databases are widely accepted. While the potential of the graph database in solving complex problems is no longer in doubt, the position of the relational database is not threatened in any way. The best thing going for the graph database is that it can be offered as an open-source technology. It is up to the industries to leverage the benefits.<\/p>\n","protected":false},"excerpt":{"rendered":" Modern-day data-driven applications are largely dependent on relevant insights derived from the enormous volumes of data they handle every day. To gain better insights every time, the applications need to be able to send complex queries and the database should be able to address complex queries. Traditional RDBMS systems that rely on SQL are unable […]<\/p>\n","protected":false},"author":7870,"featured_media":49359,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_lmt_disableupdate":"","_lmt_disable":"","om_disable_all_campaigns":false,"footnotes":""},"categories":[557,552,586,592,566],"tags":[],"category_partsoff":[],"class_list":["post-49358","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-management","category-database","category-emerging-technology","category-identity-access-governance","category-network-management"],"acf":[],"yoast_head":"\nWhat Is a Graph Database?<\/span><\/h2>\n
How Does a Graph Database Work?<\/span><\/h2>\n
Difference Between Graph Databases and Relational Databases<\/span><\/h2>\n
\n
Graph Database Case Studies<\/span><\/h2>\n
\n
Summary<\/span><\/h2>\n