Exporting from Gephi to Flow
This article is one of the Integration features supported by Flow. See also: Using Flow Datasets Integrations
Gephi is a widely-used open-source software for visualizing and analyzing large networks. One of the powerful features of Gephi is the ability to export data to various file formats. In the recent update, Gephi 0.10, users can export their data to JSON format, which is particularly useful for programmatic upload to Flow datasets. In this article, we will walk through the steps for exporting data to JSON format in Gephi and how to upload the JSON file programmatically to Flow datasets using Python.
To export data to JSON format in Gephi, follow these steps:
- Open your network in Gephi and select File -> Export -> Graph file... from the menu.
- In the Export dialog, choose JSON files (*.json) from the "Files of Type" dropdown menu.
- Specify a name for your JSON file and click the "Export" button to save the file to your local disk.
After exporting the data to a JSON file, you can programatically upload it to a Flow dataset using Python. Here's how to do it using the FlowGL library:
# Import the necessary libraries:
import json
from flowgl import Client
# Instantiate a new Flow client object
client = Client(
username="flow immersive username",
password="flow immersive password",
)
# Load the JSON file into a Python dictionary
with open('path/to/file/export.json', 'r') as f:
my_dict = json.load(f)
# Push the nodes and edges dictionary to Flow
client.push_nodes_and_edges_dict(
my_dict,
node_id_key='key',
dataset_title="My dataset name"
)
In the above code snippet, replace the username and password fields with your Flow account credentials. The node_id_key parameter specifies the key that uniquely identifies each node in the JSON file. The dataset_title parameter is the title of the Flow dataset to which you want to upload the data.
Exporting Gephi data to JSON format and uploading it to Flow datasets programmatically can save a significant amount of time for users who need to analyze and visualize large networks. With just a few lines of Python code, it's possible to streamline your workflow. We hope this article has been helpful in demonstrating how to export Gephi data to JSON and upload it to Flow datasets programmatically.
See also: Using Flow Datasets Integrations