In our auction fraud case, there is no direct relationship between users, but we still need to create a graph to run a centrality algorithm on. GDS offers a solution whereby we can create a projected graph for such cases using Cypher projection for nodes and/or relationships.
To create fake relationships between users, we consider them connected if they have joined at least one sale together. The following Cypher query returns these users:
MATCH (u:User)-[]->(p:Product)<-[]-(v:User)
RETURN u.id as source, v.id as target, count(p) as weight
The count aggregate will be used to assign a weight to each relationship: the more common sales they have, the stronger the relationship between two users.
The syntax to create a projected graph using Cypher is as follows:
CALL gds.graph.create.cypher(
"projected_graph_cypher",
"MATCH (u:User)
RETURN id(u) as id",
"MATCH (u:User)-[]->(p:Product)<...