Explore Amazon Product Co-Purchasing Network Metadata¶
Download the data
Convert the data into vertices and edges
Turn on grip and create a graph called 'amazon'
Load the vertices/edges into the graph
Query the graph
command line client
The full command syntax and command list can be found at grip/gripql/javascript/gripql.js
python client
Initialize a virtual environment and install gripql python package
Example code
import gripql
conn = gripql.Connection("http://localhost:8201")
g = conn.graph("amazon")
# Count the Vertices
print("Total vertices: ", g.V().count().execute())
# Count the Edges
print("Total edges: ", g.V().outE().count().execute())
# Try simple travesral
print("Edges connected to 'B00000I06U' vertex: %s" %g.V("B00000I06U").outE().execute())
# Find every Book that is similar to a DVD
for result in g.V().has(gripql.eq("group", "Book")).as_("a").out("similar").has(gripql.eq("group", "DVD")).as_("b").select("a"):
print(result)