In [1]:
%load_ext cypher
In [2]:
import projx as px
In [4]:
# Flicker group bipartite network from http://konect.uni-koblenz.de/networks/flickr-groupmemberships.
# 395,979 users, 103,631 groups, 8,545,307 edges (memberships).
flickergroup_etl = {
"extractor": {
"edgelist": {
"filename": "data/flickr-groupmemberships/out.flickr-groupmemberships",
"delim": " ",
"pattern": [
{"node": {"alias": "n"}},
{"edge": {}},
{"node": {"alias": "m"}}
]
}
},
"transformers": [
{
"edge": {
"pattern": [
{"node": {"alias": "n", "label": "User"}},
{"edge": {"label": "IN"}},
{"node": {"alias": "m", "label": "Group"}}
]
}
}
],
"loader": {
"edgelist2neo4j": {
"uri": "http://localhost:7474/db/data",
"stmt_per_req": 500,
"req_per_tx": 25,
"indicies": [
{"label": "User", "attr": "UniqueId"},
{"label": "Group", "attr": "UniqueId"}
]
}
}
}
In [5]:
px.execute_etl(flickergroup_etl)
In [6]:
# This uses ipython-cypher by @versae.
num_users = %cypher match (user:User) return count(user)
num_groups = %cypher match (group:Group) return count(group)
num_rels = %cypher match (user:User)-[rels:IN]->(group:Group) return count(rels)
In [7]:
print num_users, num_groups, num_rels