Reader small image

You're reading from  Learning Neo4j 3.x - Second Edition

Product typeBook
Published inOct 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781786466143
Edition2nd Edition
Languages
Tools
Concepts
Right arrow
Author (1)
Jerome Baton
Jerome Baton
author image
Jerome Baton

Jérôme Baton started hacking computers at the age of skin problems, gaming first then continued his trip by self-learning Basic on Amstrad CPC, peaking on coding a full screen horizontal starfield, and messing the interlace of the video controller so that sprites appeared twice as high in horizontal beat'em up games. Disks were three inches for 178 Kb then. Then, for gaming reasons, he switched to Commodore Amiga and its fantastic AMOS Basic. Later caught by seriousness and studies, he wrote Turbo Pascal, C, COBOL, Visual C++, and Java on PCs and mainframes at university, and even Logo in high school. Then, Java happened and he became a consultant, mostly on backend code of websites in many different businesses. Jérôme authored several articles in French on Neo4j, JBoss Forge, an Arduino workshop for Devoxx4Kids, and reviewed kilos of books on Android. He has a weakness for wordplay, puns, spoonerisms, and Neo4j that relieves him from join(t) pains. Jérôme also has the joy to teach in French universities, currently at I.U.T de Paris, Université Paris V - René Descartes (Neo4j, Android), and Université de Troyes (Neo4j), where he does his best to enterTRain the students. When not programming, Jérôme enjoys photography, doing electronics, everything DIY, understanding how things work, trying to be clever or funny on Twitter, and spends a lot of time trying to understand his kids and life in general.
Read more about Jerome Baton

Right arrow

Chapter 11. Visualizations for Neo4j

In this chapter, we will look at the fascinating domain of graph visualizations within the context of the Neo4j Graph Database Management System. We will go into the reasons why these kinds of visualizations can be so wonderfully important, discuss different technical tools to help you with these visualizations, and finally, discuss some of the common dos and don'ts within this domain.

In this chapter, we will discuss the following topics:

  • The power of visualizations, specifically graph visualizations
  • The basic principles and components of a graph visualization solution
  • Different visualization libraries and solutions on the market

With that, let's dive right in.

The power of graph visualizations


In this section, we will spend time discussing the reasons why graph visualizations are so important, and highlight some of the underpinning technologies that are used in the different solutions that we will zoom into later on.

Why graph visualizations matter!

A picture is worth a thousand words.

There are many reasons why the graph visualizations that we will discuss in this chapter, as well as the ones that we have seen previously and will show hereafter, are really nice. For a limited number of reasons, they are more than nice: they matter greatly and can have a massive impact on decisions being made--big or small. Let's discuss these.

Interacting with data visually

From a very early age, we are taught to interact with data in a cognitive way--focused on analysis, not understanding. We are not supposed to or encouraged to look at data in a creative, fun, or interesting way that induces insight. This, however, is now changing. There's an entirely new discipline...

Open source visualization libraries


Many developers that use Neo4j as their Graph Database Management System end up having some very specific needs to visualize the network and present it to their end users in an integrated way as part of their application. These Neo4j users, who are not afraid of getting their hands dirty with some code, will typically like to build the visualization using a library of tools that fit their purpose. There are several tools out there that could be used, so let's give you a little overview of the most popular ones.

D3.js

D3, pronounced dee three, is another way to refer to a library that is supposed to enable and provide data-driven documents. It is a JavaScript library to manipulate documents based on data. You can find the latest version on www.d3js.org. D3 helps you visualize data using HTML, SVG, and CSS. D3's emphasis on web standards gives you the full capabilities of modern browsers without tying yourself to a proprietary framework, combining powerful...

Closing remarks on visualizations - pitfalls and issues


It should be clear by now that once we have our data models in a Graph Database Management System like Neo4j, one of the great potential use cases for that system is tightly coupled with visualization capabilities. It is amazing what we can learn from visualizations, but we do want to point out two caveats that you should always keep in mind as you engage in a visualization project.

The fireworks effect

While graph visualizations usually have a very positive effect on their users, we--as IT people that are provided this as an interface to interact with data--must also be aware of the fact that these visualizations can be a bit too much sometimes.

We call this the fireworks effect, and while by no means specific to graph visualizations, it is an important thing to be aware of. The purpose of visualization can never be to attract oohs and aahs--that's what fireworks are supposed to do for the crowds of spectators that they attract.

Contrarily...

Cytoscape example


In this paragraph, we will see an example of the usage of another graph library named Cytoscape.

Note

Cytoscape is open source, under MIT license, and can be found on GitHub at https://github.com/cytoscape/cytoscape.js, and its documentation can be found at http://js.cytoscape.org/.

The goal is to display data from our current database, showing usage of the JavaScript driver to get the list of operating systems of the Unix family.

Here is the result of the code to follow:

Our data with Cytoscape and its breadth-first layout

Even though my javascript-fu is weak (maybe even undefined), I managed to code this in a single page.

First, the style of cytograph sets the size of the display to show the graph. Then the libraries are loaded from their respective CDNs, then, a div element for the graph is created, the UNIX node is created at this stage, although it will be repeated in the result of the Cypher query. As it is not possible to create nodes with the same identifier, there is...

Questions and answers


Question 1. If I wanted to build an application that included graph visualization, I would have to build that visualization from scratch.

  1. True
  2. False

Answer. False. While many applications benefit from a customized visualization solution, there are a number of solutions and libraries out there that can help you. At a minimum, these libraries and/or solutions will provide you with a baseline from which you can start.

Question 2. The three basic graph visualization forces used in many tools are:

  1. Gravity, Obesity, Charge
  2. Springs, Gravity, Charge
  3. Charge, Gravity, Verbosity

Answer. Springs, Gravity, Charge.

Question 3. The well-known effect of data visualizations containing too much information, so much so that the user gets confused and cannot see the wood for the trees, is often referred to as:

  1. The forest effect
  2. The loading effect
  3. The fireworks effect

Answer. The fireworks effect.

Summary


We conclude our chapter on graph visualization. In this chapter, we went through the reasons why graph visualizations matter greatly to modern-day data applications. We also illustrated different tools and techniques that can be used by application developers to create their graph database applications. We then wrapped up the chapter by pointing out some very important side effects of visualization solutions, and how we can take these effects into account when we engage in such a project.

The next chapter will cover data refactoring, because you know, the first time is not always perfect, and the model may evolve over time (spoiler: it always did, it always will).

 

 

 

 

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Learning Neo4j 3.x - Second Edition
Published in: Oct 2017Publisher: PacktISBN-13: 9781786466143
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Jerome Baton

Jérôme Baton started hacking computers at the age of skin problems, gaming first then continued his trip by self-learning Basic on Amstrad CPC, peaking on coding a full screen horizontal starfield, and messing the interlace of the video controller so that sprites appeared twice as high in horizontal beat'em up games. Disks were three inches for 178 Kb then. Then, for gaming reasons, he switched to Commodore Amiga and its fantastic AMOS Basic. Later caught by seriousness and studies, he wrote Turbo Pascal, C, COBOL, Visual C++, and Java on PCs and mainframes at university, and even Logo in high school. Then, Java happened and he became a consultant, mostly on backend code of websites in many different businesses. Jérôme authored several articles in French on Neo4j, JBoss Forge, an Arduino workshop for Devoxx4Kids, and reviewed kilos of books on Android. He has a weakness for wordplay, puns, spoonerisms, and Neo4j that relieves him from join(t) pains. Jérôme also has the joy to teach in French universities, currently at I.U.T de Paris, Université Paris V - René Descartes (Neo4j, Android), and Université de Troyes (Neo4j), where he does his best to enterTRain the students. When not programming, Jérôme enjoys photography, doing electronics, everything DIY, understanding how things work, trying to be clever or funny on Twitter, and spends a lot of time trying to understand his kids and life in general.
Read more about Jerome Baton