cancel
Showing results for 
Search instead for 
Did you mean: 

Algorithm developed using GDS core api gives different results for different graph projections

cuneyttyler
Node Clone

I developed a Multi-Threaded Multi Pair Dijkstra algorithm using GDS core api. It takes list of ids as start nodes and target nodes. When I project a graph and call my method and after that I dropped that graph projection and reproject the graph with same parameters, my algorithm gives different results.

Another issue is that it sometimes starts with a node which is not in the start nodes list. But I simply followed the procedure in the Dijkstra's algorithm from the core api. My code simply takes it and converts it into a mult-threaded, multi-paired version. The Dijkstra method stays. This might be a detail question but I'd be very grateful if you could look at my code and tell me if there is anything wrong. I tried to do decent coding concerning thread-safety.

Here is my code : https://github.com/cuneyttyler/semanticspace-neo4j-gds/blob/master/algorithms/src/main/java/com/sema...

Note: Test cases run perfectly but it gives undesired results on production.

EDIT: I logged some things and I see that the degree of the source node(or any other node I'm not sure about that) is different than actual. So the graph object interprets the node id differently I think and when traversing the relationships, it traverse wrong relationships so it returns a wrong path with wrong source nodes(Targets are also sometimes wrong too). This might be because internal node id's are different than database ids. But the api should convert the given database ids to internal ids. I think that's the way it works in other algorithms. Another interesting thing is that sometimes it returns a path with correct source and sometimes not. 

Thanks in advance.

1 ACCEPTED SOLUTION

cuneyttyler
Node Clone

I solved the issue. As I pointed out in the edit, the id's doesn't match because I forgot to convert the input parameter ids to internal ids with graph.toMappedNodeId method. After that it works correctly.

View solution in original post

1 REPLY 1

cuneyttyler
Node Clone

I solved the issue. As I pointed out in the edit, the id's doesn't match because I forgot to convert the input parameter ids to internal ids with graph.toMappedNodeId method. After that it works correctly.