r/algorithms • u/entinko • 29d ago
Help Longest path in undirected graph with weights associated to edges
Hello fellow algorithms comrades, recently I got project on my university about finding best algorithm for (in title). Currently I'm working with algorithm that builds path from random dfs and increases its weight by rotations, restarting, rebuilding fragments and adding nodes to solution. Does anyone have a better approach to such solution? I'm not asking for any finished algorithm but just thoughts that could help me improve my algorithm and maybe come up with something new
If you know any research papers worth reading in this topic, please give their names
Graph is general and can have cycles, I know that it is NP-Hard thats why I'm asking about any ideas
Thank you all in advance
6
u/SignificantFidgets 29d ago
Of the graph is acyclic (a dag) then there are fast algorithms for this. If the graph is general and can have cycles, then it's NP-hard, so it's likely that no efficient algorithm exists.
3
u/Xorlium 29d ago
https://arxiv.org/abs/1609.07450
2
u/Ordoviz11q 29d ago
Sagemath includes a heuristic algorithm and an exact Integer Linear Programming algorithm for Longest Path, see its source code.