Hi,
My task is to retrieve a small subgraph from a graph...
The user enters a query node and a number "n" that represents the number of hubs required... The required subgraph is the query node and it's neighbors up to "n" hops... i.e. growing neighborhoods around the query node up to "n" hops...
I managed to create the database, fill it, and find the user query node by using:
Objects *query1 = g->Select(person, Equal, v.SetString(q1));
I also managed to retrieve the query neighbors by:
Objects *query2 = g->Neighbors(query1, knows, Any);
I have placed the above statement in a loop that loops "n" times in order to get the neighbors up to "n" hubs... I used the CombineUnion function to combine the neighbors from all levels... as a result I got the neighbors of the user query node up to "n" hups... But I couldn't find a function that gets the edges (the edges between the neighbor nodes)... Is there one? is there an efficient way to do it?
I only can think of one un-efficient solution:
Objects *query2 = g->Neighbors(query1, knows, Any);
and then using an iterator that traverses the nodes inside query2 (lets say node "0" and node "1") and do the following:
edge 1 = q1 and 0
edge 2 = q1 and 1
and then use the neighbors function twice once to retrieve the neighbors of node "0" and another to retrieve the neighbors of node "1" and so on!!!
Please let me know if there is an efficient solution...
Best regards,
Nouf