diff --git a/ICD.Common.Utils/RecursionUtils.cs b/ICD.Common.Utils/RecursionUtils.cs
index 1ef3408..f6a427a 100644
--- a/ICD.Common.Utils/RecursionUtils.cs
+++ b/ICD.Common.Utils/RecursionUtils.cs
@@ -383,6 +383,33 @@ namespace ICD.Common.Utils
}
}
+ ///
+ /// Walks through a map of nodes from the starting point.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ [NotNull]
+ public static IEnumerable GetPath([NotNull] T start, [NotNull] T end, [NotNull] IDictionary nodeParents)
+ {
+ // ReSharper disable CompareNonConstrainedGenericWithNull
+ if (start == null)
+ // ReSharper restore CompareNonConstrainedGenericWithNull
+ throw new ArgumentNullException("start");
+
+ // ReSharper disable CompareNonConstrainedGenericWithNull
+ if (end == null)
+ // ReSharper restore CompareNonConstrainedGenericWithNull
+ throw new ArgumentNullException("end");
+
+ if (nodeParents == null)
+ throw new ArgumentNullException("nodeParents");
+
+ return GetPath(start, end, nodeParents, EqualityComparer.Default);
+ }
+
///
/// Walks through a map of nodes from the starting point.
///
@@ -393,7 +420,7 @@ namespace ICD.Common.Utils
///
///
[NotNull]
- private static IEnumerable GetPath([NotNull] T start, [NotNull] T end, [NotNull] IDictionary nodeParents,
+ public static IEnumerable GetPath([NotNull] T start, [NotNull] T end, [NotNull] IDictionary nodeParents,
[NotNull] IEqualityComparer comparer)
{
// ReSharper disable CompareNonConstrainedGenericWithNull
@@ -424,13 +451,10 @@ namespace ICD.Common.Utils
visited.Add(start);
T next;
- if (!nodeParents.TryGetValue(start, out next))
- break;
-
// ReSharper disable CompareNonConstrainedGenericWithNull
- if (next == null)
+ if (!nodeParents.TryGetValue(start, out next) || next == null)
// ReSharper restore CompareNonConstrainedGenericWithNull
- break;
+ throw new InvalidOperationException("No path");
if (visited.Contains(next))
break;