1

I've coded a depth first search from a graph using euler algorithm of getting a cycle and splice subcicles into the result.

The problem is, to very large data, it isn't fast enough to find the correct path, namely on the dfs worst case scenario.

I've ordered the adjacency list and start at a given point, to finish at the same starting point. My idea to improve was to make the search bidirectional but that adds alot of complexity dealing with the dead ends when I want to add order to the result.

My question is basically if there is some other way to get around the worst case scenario or how to properly deal with dead ends on bidirectional search so the result will stay numericly ordered?

Any input is welcome.

Andrew
  • 13,757
  • 13
  • 66
  • 84
d0pe
  • 573
  • 4
  • 9
  • 23
  • 1
    Post your code, and accept some answers. – Reverend Gonzo Mar 21 '12 at 14:44
  • http://stackoverflow.com/faq#signatures – Andrew Mar 21 '12 at 14:55
  • Post some code, or you can try the new cs.stackexchange.com for any theoretical insight you are looking for. – n_x_l Mar 21 '12 at 15:14
  • Sorry for no code, but it is irrelevant since what I'm pursuing isn't implemented, basically, I wanna traverse a graph bidirectionally in an ordered way. If you check https://en.wikipedia.org/wiki/Euler_path#Constructing_Eulerian_trails_and_circuits , I have the Hierholzer's algorithm implemented but it isn't fast enough. In order to make it faster, I need bidirectional traverse keeping an ordered result. As an example, 1-3-2-4-1 is a correct answer, 1-4-2-3-1 is not. The problem bitraversing it is that bottom up ordering messes up with top bottom order – d0pe Mar 21 '12 at 17:42
  • For a large data, of 201 elements for instance, bi traversing from top bottom would go 1-2-3-1-4-2-5-1-6-2-7-1-etc from bottom up it would be 195-200-196-201-197-198-199-197-200-198-201-199-200-201-1 but, if you always get the last on the list starting from number one, you get 193-200-194-201-195-200-196-201-197-200-198-201-199-200-201-1 that isnt numericly ordered. This is the main issue – d0pe Mar 21 '12 at 17:49
  • @d0pe: You should try to ask at http://cs.stackexchange.com/. You may get some answers there. – pad Mar 25 '12 at 11:29

0 Answers0