java - How large does a graph need to be to trigger the worst-case complexity of a Fibonacci heap? -


i've been trying trigger worst-case complexity of fibonacci heap using dijkstra's algorithm apparently no luck. have second implementation of dijkstra's using vanilla binary heap, , seems win. told conduct tests using larger datasets, have, shown (copy-pasted straight program):

running dijkstra's algorithm 3354 nodes , 8870 links... source node: time using binary heap = 2167698339 ns (2167.70 ms) 

versus...

running dijkstra's algorithm 3354 nodes , 8870 links... source node: time using fibonacci heap = 11863138070 ns (11863.14 ms) 

2 seconds, against ~12 seconds. quite difference alright.

now, have graph whopping 264,000 nodes , 733,000 edges. haven't had chance test yet, enough theoretical advantage of fibonacci heaps shine?

i hope don't need on million nodes. mean it's not biggest issue in world nice see difference in action once.

first of question's title not correct. size of input not affect worst case complexity. need size of graph asymptotic computational complexity of fibonacci heap makes constant factor. remember old o(n)? o(n) mean large enough datasets algorithm perform approximately k*n operations, k fixed number. k constant refering to. if have algorithm complexity o(n) , compexity o(n*log(n)), still not mean first 1 faster second one. imagine first 1 performs k1*n operations , second 1 performs k2n*log(n) operations. if k1 = k2 * 1000, fact first algortihm faster second 1 if n > 21000, quite large. important if have value first algorithm overtake second one.

depending on implementation of given datastructure, constant may vary , may need several times larger dataset make it. have seen results fibonacci heap got faster plain old binary heap @ 500 000 edges(and 5000 nodes) these particular implementation. in implemenation difference may show earlier, or later depending on how efficiently implemented both structures. if implemented data structures correct complexities, difference show n(but may happen no existing computer can handle graphs big).


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -