Is there an algorithm to search a directed graph (tree) for its neighbors neighbor?
My current brute-force solution works as follows:
for each node n: for each child c of n for each parent p of c if (p != n) insert edge (p,n)
I am dealing with ca. 700.000 nodes each having between 1 to 1000 edges and currently I am facing too long running times: which is mainly due to the reason I am executing this algorithm on a graph database, since it would require too much memory.