Skip to content
How to render a complex AiiDA graph using GePhi
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.


Type Name Latest commit message Commit time
Failed to load latest commit information.

Create artistic rendering of graph


  • AiiDA profile with graph to render
  • GePhi >= 0.9.1

Importing the graph

You can import the graph from AiiDA into GePhi either via .dot files or by connecting GePhi directly to the AiiDA database.

Via .dot files

  1. Generate .dot files for every graph you would like to include. E.g.

AiiDA 0.12.x

from aiida.orm import WorkCalculation
from import StructureData
import os

# Query for all structures of interest
qb = QueryBuilder()
qb.append(WorkCalculation, filters={ 'attributes.function_name': {'==': 'collect_outputs'} }, tag='collect')
qb.append(StructureData, project=['*'], edge_filters={'label': 'ref_structure'}, input_of='collect')
structures = [ r[0] for r in results]

# Generate graph for all those structures
for s in structures:
    os.system("verdi graph generate {}".format(
  1. Open GePhi, select File => Open and select all .dot files

Via PostgreSQL database

  1. Open GePhi, select File => import Database => Edge list
  2. Fill databasei connection info with your AiiDA profile connection info
  3. Write appropriate queries as seen below

GePhi AiiDA DB connection example

Styling the graph

  1. In "Overview" select e.g. Layout => ForceAtlas2
  2. In "Preview" select e.g. "Dark Background"


Tips & tricks

  1. There are powerful filter methods available in Overview => Filters => Topology (e.g. remove all but the largest one by selecting "Giant component")
  2. The apparent brightness of node edges can be affected by resolution of the PNG export (e.g. a finer resolution might, correctly, render the edges as thinner). In this case, you can play with the edge thickness to counteract this.
  3. Removing unexpected rectangles: With the default merge policy "sum", the weight of some edges can grow very large. In the Data Laboratory, click on "Edges" and sort by "Weight" to edit.


example graph


Thanks go to Jens Bröder for the original idea and Giovanni Pizzi for SQL assistance.

You can’t perform that action at this time.