matiii/Dijkstra.NET

Connect nodes by values

ridicoulous opened this issue · 3 comments

I would like to have opportunity to connect nodes by their values. But here is some point of performance of searching in dictionary by values as tested here . Surely, I can store node key with it value as result of AddNode method, but by this way are very possible to eat whole RAM by duplication, by the fact, the same data. What solution will be optimal, you think? I prepared some simple solution and waiting for your response for previous PR.

It sad, but it really horrible slow way to connect nodes by value, I just tested it on 350K edges. And didn't wait for the end of the operation=). But this solution still may be useful for small (<3-5k edges) graphs. For biggest you need to have good prepared data or use additional tricks, for example, like dictionary mirrored from node's dictionary.

I think the best approach to connect nodes by theirs values is provide index based on for instance dictionary. At present library has only graph memory operation so is not good tool for huge graphs. To work with it the best option is just filter nodes per purpose and build subgraph to resolve problem. Since 2.x version library will provide persisted on disk graph then this approach could be useful. I am not sure If answer is good enough for you :)

No answer sine year.