DEV Community

Emmanuel Allison
Emmanuel Allison

Posted on

Using AGE Viewer to View Graphs

A graph is a data structure containing vertices (or nodes) and edges. The vertices represent objects or entities, while the edges represent the relationship between these vertices.

Using Apache AGE, PostgreSQL can be given the functionalities of a graph database. We will be able to create graph databases and manipulate them in PostgreSQL, and AGE Viewer gives us a visual representation of these graphs.


Apache AGE requires node (version 14.16.0 recommended) and npm to run. To download node, we'll be using Node Version Manager (nvm).

Installing nvm

Run the following command in your terminal.

sudo apt install curl 
curl | bash 
Enter fullscreen mode Exit fullscreen mode

After the installation is completed, reload the terminal to effect the changes.

Installing node

Install node version 14.16.0 using nvm.

nvm install 14.16.0
Enter fullscreen mode Exit fullscreen mode

To check your installation, run the following commands to view the versions of node and npm.

node -v
npm -v
Enter fullscreen mode Exit fullscreen mode

Installing AGE Viewer

Clone AGE Viewer from its repository.

git clone
Enter fullscreen mode Exit fullscreen mode

Now, install the required node modules and start the viewer. To do that, go into the AGE Viewer folder and run:

npm run setup
npm run start
Enter fullscreen mode Exit fullscreen mode

AGE Viewer will run on localhost:3000 if port 3000 is free.

Viewing a Graph Database

For this, we'll be using the same data used in my article, Six Degrees of Separation Using Apache AGE.

Connect to your database in AGE Viewer using the following parameters:

  • Connect URL: localhost
  • Connect Port: 5432 (PostgreSQL's port by default)
  • Database Name:
  • User Name:
  • Password: The username and password for the connection, if not set, will be the name and password of the current user.

Run the following code in AGE Viewer.

SELECT * FROM cypher('social_network', $$
    MATCH (a:Person)-[e]-(b:Person)
    RETURN a, e, b
$$) AS (a agtype, e agtype, b agtype);
Enter fullscreen mode Exit fullscreen mode

Running a cypher query in AGE Viewer

The graph will be displayed.

Graph displayed in AGE Viewer

Top comments (0)