In [ ]:
import random
import graphistry as g
import pandas as pd
from random import choice
from string import ascii_letters
from IPython.display import IFrame
In [ ]:
g.__version__
In [ ]:
API_KEY = 'Go to www.graphistry.com/api-request to get your API key'
In [ ]:
g.register(api=1, key=API_KEY)
In [ ]:
edges = pd.DataFrame({'src': [ random.randint(0, 1000) for x in range(800000)],
'dest': [random.randint(0, 1000) for x in range(800000)]})
edges[:3]
In [ ]:
g.edges(edges).bind(source='src', destination='dest').plot()
In [ ]:
edges2 = edges;
nodes = pd.DataFrame({'name':[x for x in range(0, 1000)]})
In [ ]:
for i in range(5):
edges2['intFld' + str(i)] = edges2.src.map(lambda x: random.randint(0, 100000))
for i in range(5):
nodes['intFld' + str(i)] = nodes.name.map(lambda x: random.randint(0, 100000))
In [ ]:
g.edges(edges2).nodes(nodes).bind(source='src', destination='dest', node='name').plot()
In [ ]:
edges = pd.DataFrame({'src': [ random.randint(0, 100) for x in range(50000)], 'dest': [random.randint(0, 100) for x in range(50000)]})
In [ ]:
nodes = pd.DataFrame({'name':[x for x in range(0, 100)]})
In [ ]:
for i in range(100):
edges['intFld' + str(i)] = edges.src.map(lambda x: random.randint(0, 100000))
for i in range(5):
nodes['intFld' + str(i)] = nodes.name.map(lambda x: random.randint(0, 100000))
In [ ]:
g.edges(edges).nodes(nodes).bind(source='src', destination='dest', node='name').plot()
In [ ]:
edges = pd.DataFrame({'src': [ random.randint(0, 100) for x in range(10000)],
'dest': [random.randint(0, 100) for x in range(10000)]})
In [ ]:
for i in range(100):
edges['intFld' + str(i)] = edges.src.map(lambda x: (''.join(choice(ascii_letters) for i in range(32))))
for i in range(5):
nodes['intFld' + str(i)] = nodes.name.map(lambda x: random.randint(0, 100000))
In [ ]:
g.edges(edges).nodes(nodes).bind(source='src', destination='dest', node='name').plot()
In [ ]:
url = 'http://' + SERVER + '/graph/graph.html?dataset=Epinions&scene=default&info=true&play=10000&mapper=splunk&splashAfter=1477695505'
IFrame(url, width=700, height=350)
In [ ]:
url = 'http://' + SERVER + '/graph/graph.html?dataset=Facebook&scene=default&info=true&play=10000&mapper=opentsdb&splashAfter=1477695505'
IFrame(url, width=700, height=350)
In [ ]:
# Much larger than 800,000 nodes + edges. Does not need to render in 20 seconds.
url = 'http://' + SERVER + '/graph/graph.html?dataset=Amazon&scene=default&info=true&play=10000&mapper=splunk&splashAfter=1477695505'
IFrame(url, width=700, height=350)