Practical 10: Neo4j Graph Database and Gephi Tool

Maharshi Relia
4 min readOct 28, 2021

18IT110: Maharshi Relia

Introduction to Neo4j

Neo4j

Neo4j is a graph database management system developed by Neo4j, Inc. Described by its developers as an ACID-compliant transactional database with native graph storage and processing, Neo4j is available in a GPL3-licensed open-source “community edition”, with online backup and high availability extensions licensed under a closed-source commercial license. Neo also licenses Neo4j with these extensions under closed-source commercial terms.

Neo4j is implemented in Java and accessible from software written in other languages using the Cypher query language through a transactional HTTP endpoint, or through the binary “Bolt” protocol.

International Standard

Neo4j delivers the lightning-fast read and write performance you need, while still protecting your data integrity. It is the only enterprise-strength graph database that combines native graph storage, scalable architecture optimized for speed, and ACID compliance to ensure the predictability of relationship-based queries.

Let Start the demo,

Check out the tool here.

For demo purposes, I have use Movies Datasets which are by default available in the neo4j tool. After selecting the dataset I have performed various queries.

Here I going to list out some columns which is in the dataset.

OrderID : String
CustomerID : String
PlaceID: Integer
ProductID : String
SalesID: Integer
Sales: Integer
Quantity: Integer
Cost: Integer
Discount : Float

Query:

MATCH (m:Movie) where m.released > 2006 RETURN m
5 movies which are released after 2006

2. Query movies released after 2002 and limit the movie count up to 3only.

Query:-

MATCH (m:Movie) where m.released > 2002 RETURN m limit 3
3 movies were displayed

3. The below query returns the name of the person, director, and movie name that are released after the year 2007 up to a limit of 5.

Query:-

MATCH (p:Person)-[d:DIRECTED]-(m:Movie) where m.released > 2007 RETURN p,d,m limit 5
9 movies were displayed

4. If we want to know the list of the persons that are available in the database we can use the following which queries the list of people but limits the output up to 10 people only.

Query:-

MATCH (p:Person) RETURN p limit 10
displaying 10 nodes

5. If one wants to search whether a movie with a particular name is present or not the following query.

Query:-

MATCH (m:Movie {title: 'A Few Good Men'}) RETURN m
displaying 1 node

Gephi Tool

Gephi is an open-source network analysis and visualization software package written in Java on the NetBeans platform.

Check out gephi tool from here.

In this demo, I have chosen simple lesmiserables.gml dataset and performed some basic gephi operations on it. So let’s get started.

  1. First open the gephi tool and click on the new project. After that choose File->Open and load the dataset of your choice as shown below. And Load the dataset.
Load the dataset

In the image you can see there are no Issues and what are nodes and edges will available in that it was displayed.

2. Below is how all the nodes and edges are displayed l after the load of the dataset.

Load the dataset display nodes and edges

3. Then After clicking on Layout and choose ForceAtlas and click on the run button.

image of ForceAtlas

4. Next we can differentiate the nodes based on a various ranking like their In-Degree, Out-Degree, or Degree and show them in different colors. For this in the left pane on the top side choose Nodes->Ranking there choose the ranking like in the below image Degree is chosen.

Ranking of nodes and edges

5. For data table click on windows->data table.

data table

6. Next we generate a Degree Distribution graph for Degree, In-Degree, and Out-Degree and also get the Average Degree value for all the nodes. for that click on the right pane choose the Statistics tab, and there run Average Degree in the Network Overview section.

7. Average degree report you see when you click on the run button in the above image.

Degree Reports

--

--

Maharshi Relia

IT Consultant | UI-UX Designer | Web Developer | SEO Analyst & Executive | Marketing Executive | Passionate Hotelier