In [2]:
%matplotlib inline
%load_ext gremlin
import asyncio
import aiogremlin
import networkx as nx
A binary mathematical structure consisting of nodes and edges:
$g = \begin{bmatrix}0 & 1\\1 & 0\end{bmatrix}$
In [8]:
g = nx.scale_free_graph(10)
nx.draw_networkx(g)
But wait...these graphs are more than ones and zeros...
Ahn, Y. Y., Ahnert, S. E., Bagrow, J. P., & Barabási, A. L. (2011). Flavor network and the principles of food pairing. Scientific reports, 1.
Schich, M., Song, C., Ahn, Y. Y., Mirsky, A., Martino, M., Barabási, A. L., & Helbing, D. (2014). A network framework of cultural history. Science, 345(6196), 558-562.
Neo4jrestclient by versae - 58977 downloads
SylvaDB
Interested in SylvaDB? Check out Javier de la Rosa's talk tomorrow at 11:00 in Colonel By E015
Interested in the Preliminaries Project? Check out my talk on Wednesday at 1:15 in Colonel By C03
Preliminaries Projections required a wide variety of schema transformations and projections.
A tedious task to be sure.
Enter projx - a graph transformation library written in Python with a Cypher based DSL
subgraph = projection.execute("""
MATCH (p1:Person)-(wild)-(p2:Person)
PROJECT (p1)-(p2)
METHOD NEWMAN Institution, City
SET label = wild.label
DELETE wild
""")
In [9]:
@asyncio.coroutine
def stream(gc):
results = []
resp = yield from gc.submit("x + x", bindings={"x": 1})
while True:
result = yield from resp.stream.read()
if result is None:
break
results.append(result)
return results
loop = asyncio.get_event_loop()
gc = aiogremlin.GremlinClient()
results = loop.run_until_complete(stream(gc))
In [10]:
results
Out[10]:
In [11]:
loop.run_until_complete(gc.close()) # Explicitly close client!!!
In [12]:
%%gremlin
graph = TinkerFactory.createModern()
g = graph.traversal(standard())
g.V().has('name','marko').out('knows').values('name')
Out[12]:
Identify statistical regularities in the production and diffusion of Spanish literature.
13,188,245 records from OCLC
Neo4j/Tinkerpop/Apache Spark
Interested? Check out my talk on Wednesday at 11:00 in Louis-Pasteur 155