Python: Create Gephi network graphs from Python?

From OnnoWiki
Revision as of 06:57, 24 January 2017 by Onnowpurbo (talk | contribs) (Created page with "I have just found out about GephiStreamer. https://pypi.python.org/pypi/GephiStreamer Using this package one can send instructions from python to Gephi to create nodes and ed...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

I have just found out about GephiStreamer. https://pypi.python.org/pypi/GephiStreamer

Using this package one can send instructions from python to Gephi to create nodes and edges in Gephi.

  1. Create a node with a custom_property

node_a = graph.Node("A",custom_property=1)

  1. Create edge

edge_ab = graph.Edge(node_a,node_b,custom_property="hello") stream.add_edge(edge_ab)

Similarly I want to do everything in Gephi through Python. Here is what I typically do.

ex:

steps:

  • load nodes
  • load edges
  • calculate betweeness centrality
  • change the size/color of nodes as per their centrality scores
  • change the graph layout (such as forceatlas2)
  • give the output graph

Below is the output I have got manually, but I want to produce the same by sending instructions from python to Gephi. Documentation doesn't tell anything beyond creating nodes, edges and graphs.

I have also found out about NetworKit. https://networkit.iti.kit.edu/data/uploads/docs/NetworKit-Doc/python/html/gephi.html

This is slightly better than gephistramer, but this requires python 3.4 or higher and most of the packages like pandas, numpy or sickit are in 2.7.


Referensi