GephiForceDiagramTool: Automatically create attractive network visualizations

August 31, 2016 Adrianna Jelesnianska

One aspect of the people-centered data science that we do at Civis is social network analysis. Connections between people in the online or physical world can give us insight into how a population can be segmented or how information spreads in a community.

As we look to get the most extensive understanding of these network connections, we have turned to one open-source project, Gephi, a java-based tool for interactively exploring networks and creating attractive visualizations. For instance, below is a diagram we made to illustrate the polarization of the discussion around climate change on Twitter. There is a clearly separable block of users who are generally skeptical of climate science, and have relatively few connections to the larger community.

Gephi visualization of Twitter network discussion

Gephi’s GUI allows users to explore a network and determine the layout parameters that work best, but it doesn’t allow the process to be automated once the best parameters have been determined. In furthering the usefulness of Gephi for our needs, we’ve created GephiForceDiagramTool, a command-line application that provides access to core functionality for creating force-directed graph diagrams using Gephi. And today, we’re happy to announce that we’re open sourcing it. The Gephi Toolkit allows users to access the underlying Java API for Gephi’s layout and rendering algorithms, but using the toolkit effectively requires a good deal of knowledge about Gephi’s internal data representation and processing model. Our goal with the GephiForceDiagramTool is to allow users to more easily automate the creation of force-directed graphs, providing a command-line interface that is simple to use, yet exposes the most important configuration options for diagrams of this type.

For instance, you can download a network data file representing adjacent adjective-noun pairs in the novel David Copperfield from M. E. J. Newman’s website, and create a diagram of the relationships using a relatively simple command:

java    --gml_input_file adjnoun.gml
           --png_output_file adjnoun.png
           --gravity 0.5
           --scaling_ratio 150.0
           --jitter_tolerance 1.5
           --node_label_column label
           --node_size_column value
           --node_color_column value
           --min_node_size 30
           --max_node_size 50
           --min_label_size 1
           --max_label_size 2
           --layout_time_seconds 5
           --edge_opacity 30
           --color_palette_source colorbrewer
           --color_palette_type diverging
           --color_palette_number 0
           --num_colors 2
           --node_color_type ranking
           --label_percentile 0 

Check out the documentation to learn more about all of these options. The resulting diagram looks like this:

Gephi network relationship diagram

We’ve open-sourced GephiForceDiagramTool under the BSD 3-Clause License, and made the source available on GitHub. We encourage you to use it in your own work, and we welcome community contributions.

The post GephiForceDiagramTool: Automatically create attractive network visualizations appeared first on Civis Analytics.

Previous Article
A Data Scientist’s View into the Cancer Moonshot Project: Part 1, Data Infrastructure
A Data Scientist’s View into the Cancer Moonshot Project: Part 1, Data Infrastructure

Working at Civis, I’m able to use my PhD both on data science research and development and real world probl...

Next Article
glmnet for Python
glmnet for Python

I’ve learned many things since I joined Civis. Least expected though is a new appreciation for simple linea...