How can i find FoFoF in Spark GraphX ?
In Cypher i have query:
MATCH (f:Friend)-[:friend_of]-(Friend)-[:friend_of]-(c:Friend)
WHERE c.name STARTS WITH "T"
RETURN f.name AS Friend1 , c2.name as Friend2
Another example from here
MATCH (john {name: 'John'})-[:friend]->()-[:friend]->(fof)
RETURN john.name, fof.name
Basicly what it dose: this query finds a user called 'John' and 'John’s' friends (though not his direct friends) before returning both 'John' and any friends-of-friends that are found
- What the alternative implmentation of Spark GraphX ?
- How can i implement this query as Spark GraphX?
This is example from Spark Graph X:
// Create an RDD for the vertices
val users: RDD[(VertexId, (String, String))] =
sc.parallelize(Array((3L, ("rxin", "student")), (7L, ("jgonzal", "postdoc")),
(5L, ("franklin", "prof")), (2L, ("istoica", "prof")),
(4L, ("peter", "student"))))
// Create an RDD for edges
val relationships: RDD[Edge[String]] =
sc.parallelize(Array(Edge(3L, 7L, "friend_of"), Edge(5L, 3L, "friend_of"),
Edge(2L, 5L, "friend_of"), Edge(5L, 7L, "friend_of"),
Edge(4L, 0L, "friend_of"), Edge(5L, 0L, "friend_of")))
// Define a default user in case there are relationship with missing user
val defaultUser = ("John Doe", "Missing")
// Build the initial Graph
val graph = Graph(users, relationships, defaultUser)
// Where do we go, Where do we go now..?!
All the examples in the GraphX that i saw, are in same concept Node->Rel->Node
. but how to do Node->Rel->Node->Rel->Node