justcoding121 / advanced-algorithms

100+ algorithms & data structures generically implemented in C#
MIT License
1.31k stars 290 forks source link

Dijikstra TracePath bug #5

Closed ghost closed 6 years ago

ghost commented 6 years ago

tracePath method implementation not working for all Nullible types. While loop:

while (!currentV.Equals(default(T)) && !parentMap[currentV].Equals(default(T)))

Will throw null reference exception on null.equals(null)

justcoding121 commented 6 years ago

https://www.nuget.org/packages/Advanced.Algorithms/0.0.140-beta

Please try latest release.

ghost commented 6 years ago

Still fails here: !parentMap[currentV].Equals(default(T)). Need to be:

while (!Equals(currentV, default(T)) && !Equals(parentMap[currentV], default(T))) ...

justcoding121 commented 6 years ago

Updated

justcoding121 commented 6 years ago

Plz one if not fixed. Thx