mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-11 10:45:05 +00:00
Fixing bug where breadth-first search was not returning desired result when root and destination are the same
This commit is contained in:
@@ -69,6 +69,10 @@ namespace ICD.Common.Utils
|
||||
if (comparer == null)
|
||||
throw new ArgumentNullException("comparer");
|
||||
|
||||
// Edge case - root and destination are the same
|
||||
if (comparer.Equals(root, destination))
|
||||
return new[] {root};
|
||||
|
||||
Queue<T> queue = new Queue<T>();
|
||||
queue.Enqueue(root);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user