Gephi Visual Tool

image

Introduction

Gephi is a visual tool to manipulate and analyze graphs. Gephi is an Open Source project. Take a look at the amazing features.

Gephi can be used to analyze graphs extracted from OrientDB. There are 2 level of integration:

In this mini guide we will take a look at the first one: the streaming plugin.

For more information:

Getting started

Before to start assure you’ve OrientDB 1.1.0-SNAPSHOT or greater.

Download and install

  1. To download Gephi goto: http://gephi.org/users/download/
  2. Install it, depends on your OS
  3. Run Gephi
  4. Click on the menu Tools -> Plugins
  5. Click on the tab Available Plugins
  6. Select the plugin Graph Streaming, click on the Install button and wait the plugin is installed

Import a graph in Gephi

Before to import a graph assure a OrientDB server instance is running somewhere. For more information watch this video.

  1. Go to the Overview view (click on Overview top left button)
  2. Click on the Streaming tab on the left
  3. Click on the big + green button
  4. Insert as Source URL the query you want to execute. Example: http://localhost:2480/gephi/demo/sql/select%20from%20v/100 (below more information about the syntax of query)
  5. Select as Stream type the JSON format (OrientDB talks in JSON)
  6. Enable the Use Basic Authentication and insert the user and password of OrientDB database you want to access. The default user is “admin” as user and password
  7. Click on OK button

Executing a query

The OrientDB’s “/gephi” HTTP command allow to execute any query. The format is:

  1. http://<host>:<port>/gephi/<database>/<language>/<query>[/<limit>]

Where:

  • host is the host name or the ip address where the OrientDB server is running. If you’re executing OrientDB on the same machine where Gephi is running use “localhost”
  • port is the port number where the OrientDB server is running. By default is 2480.
  • database is the database name
  • language
  • query, the query text following the URL encoding rules. For example to use the spaces use %20, so the query select from v becomes select%20from%20v
  • limit, optional, set the limit of the result set. If not defined 20 is taken by default. -1 means no limits

SQL Graph language

To use the OrientDB’s SQL language use sql as language. For more information look at the SQL-Syntax.

For example, to return the first 1,000 vertices (class V) with outgoing connections the query would be:

  1. SELECT FROM V WHERE out.size() > 0

Executed on “localhost” against the “demo” database + encoding becomes:

  1. http://localhost:2480/gephi/demo/sql/select%20from%20V%20where%20out.size()%20%3E%200/1000

GREMLIN language

To use the powerful GREMLIN language to retrieve the graph or a portion of it use gremlin as language. For more information look at the GREMLIN syntax.

For example, to return the first 100 vertices:

  1. g.V[0..99]

Executed on “localhost” against the “demo” database + encoding becomes:

  1. http://localhost:2480/gephi/demo/gremlin/g.V%5B0..99%5D/-1

For more information about using Gephi look at Learn how to use Gephi