Skip to main content

Tools to stream data to gephi

Project description

GephiStreamer
=============

Python classes for streaming graph to gephi
Install
======

Download and unzip in your python project in %base%/GephiStreamer/

/!\ Requests module is needed (http://docs.python-requests.org/en/latest/#) /!\

Quick use
======

```python
from GephiStreamer import Node,Edge,GephiStreamerManager

a = Node("A", red=1) # Create a node
a.property['category']= '1' # add a property
b = Node("B",blue=1) # Create a node
b.property['category']= '2' # add a property
e = Edge('A',b,True) # Create edge, can use Node type or Id of node for Source and Destination
t = GephiStreamerManager() # Streamer Manager (default http://localhost:8080/workspace0)
t.add_node(a)
t.add_node(b)
t.add_edge(e)
t.commit() # Send everything > Group streaming by action (e.g if you have 1000 nodes to add, it will send only one message to gephi)
""" Or Alternative
t.send(GephiStreamerManager.ADD_NODE,a) # send a to gephi
t.send(GephiStreamerManager.ADD_NODE,b) # send b to gephi
t.send(GephiStreamerManager.ADD_EDGE,e) # send e to gephi

"""
```
Direct Send Mode
=====
Direct Send Mode use the GephiStreamerManager.send method to send one action immediatly.
```python
from GephiStreamer import Node,Edge,GephiStreamerManager
t = GephiStreamerManager() # Streamer Manager (default http://localhost:8080/workspace0)

a = Node("A", red=1)
t.send(GephiStreamerManager.ADD_NODE,a)
b = Node("B",blue=1)
e = Edge('A',b,True)


t.send(GephiStreamerManager.ADD_NODE,b) # send b to gephi
t.send(GephiStreamerManager.ADD_EDGE,e) # send e to gephi

```
This mode is usefull for quick implementation.


Transaction Mode
=====
The transaction mode store all the action to perform and will send only at commit GephiStreamerManager.call
```python
from GephiStreamer import Node,Edge,GephiStreamerManager
t = GephiStreamerManager() # Streamer Manager (default http://localhost:8080/workspace0)

a = Node("A", red=1) # Create a node
b = Node("B",blue=1) # Create a node
e = Edge('A',b,True)

t.add_node(a)
t.add_node(b)
t.add_edge(e)
t.commit()

```
The advantage to use this mode is that it will pack all same actions into one gephi call, whereas the Driect Send Mode do one call per entity.
It's should be faster for creating large set of entities in "one shot"

Example: I want to create 1 node that have a edge to 10 000 other nodes

* Direct Send Mode : will operate 20 001 calls (10 001 calls for nodes, 10 000 for edges)
* Transaction Mode : will operate 2 calls (1 for add 10 001 nodes, 1 for add 10 000 edges)

Gephi Instance
=====
Default Gephi instance targeted is localhost on port 8080
```python
t = GephiStreamerManager()
```

To stream a remote Gephi instance use the argument iGephiUrl
```python
t = GephiStreamerManager(iGephiUrl='ip_or_machine_name:myport')
```

To stream to a different workspace, usr the argument iGephiWorkspace
```python
t = GephiStreamerManager(iGephiWorkspace='workspace1')
```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

GephiStreamer-1.0.1.zip (11.8 kB view details)

Uploaded Source

File details

Details for the file GephiStreamer-1.0.1.zip.

File metadata

  • Download URL: GephiStreamer-1.0.1.zip
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for GephiStreamer-1.0.1.zip
Algorithm Hash digest
SHA256 8620ae612dabe8f54e9e07c29e64b600f8d3df91773c24ea000cec54108b043a
MD5 1faac2ded27a767eac5dae1dd02b4190
BLAKE2b-256 ed6bebe045ef57acc1993819ed804c6c48a2128ffe2c2b8cd3dfcf533bcb9a98

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page