WITH REVERSE_EDGEclause means that for every two vertices (x,y) connected by a Liked type of edge, the system will automatically generate a corresponding edge of type Liked_By pointing from y to x, and both edges will have the same edge attributes.
cf_model.gsql, and then run the command file. From within the shell, you would run
@cf_model.gsqlFrom outside the shell, you would run
lscommand from within the GSQL shell to see a report as below:
DROPcommand. Use the
helpcommand to see a summary of available GSQL commands.
Uservertices, one edge type of
Liked, and one edge type of
Liked_By. For the second row, however, only one new vertex will be created since
id2has been seen already. Two edges will be created for the second row.
SELECT *displays information in JSON format. Below is an example of query output.
input_userparameter. Suppose the input user is
id1. Next, the L1 statement starts from every vertex in the set L0, traverses every connected edge of type Liked_By and returns every target vertex (that is, the other ends of the connected edges). As a result, L1 is the set of all users who liked the input user. Referring to the graph in Figure 2, the query travels backwards along every Liked edge which points to
id1, arriving at
id5. These three vertices form L1. Next, the L2 statement starts from each user in L1, travels to every user liked by that starting user (via the Liked type of edges), and increments the count for each User reached. That is, the algorithm counts how many times each vertex is visited by a query path. The WHERE condition makes sure the original input user will not be returned in the result.ORDER BY and LIMIT have the same meaning as in SQL. Below, we show how the L2 step tallies the counts for each vertex encountered:
ADD VERTEX | DIRECTED EDGE | UNDIRECTED EDGE
DROP VERTEX | DIRECTED EDGE | UNDIRECTED EDGE
ALTER VERTEX vertex_type | EDGE edge_type ADD ATTRIBUTE (name type)
ALTER VERTEX vertex_type | EDGE edge_type DROP ATTRIBUTE (name)
localhost) and data/cf_mod3_input.json is a text file containing the following JSON-encoded data:
gsql 'DROP ALL'
FROMclause used to represent the direction of a directed edge.