 | topologicalSortTopologicalSortT, TDependencies Method |
Orders elements in an
IEnumerableT so that each element appears after its dependents.
Namespace:
WhetStone.Looping
Assembly:
WhetStone (in WhetStone.dll) Version: 1.0.4.0 (1.0.0.0)
Syntaxpublic static IEnumerable<T> TopologicalSort<T, TDependencies>(
this IEnumerable<Tuple<T, TDependencies>> elements,
bool allowMissingDependancy = false
)
where TDependencies : Object, IEnumerable<T>
Parameters
- elements
- Type: System.Collections.GenericIEnumerableTupleT, TDependencies
An IEnumerableT of tuples. The first element of the tuple is the element itself, the second is an ICollectionT of its dependents. - allowMissingDependancy (Optional)
- Type: SystemBoolean
Whether to ignore dependencies that are not in elements.
Type Parameters
- T
- The type of the elements.
- TDependencies
- The type of the dependency collection.
Return Value
Type:
IEnumerableTAll the elements in
elements ordered topologically.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableTupleT,
TDependencies. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
ExceptionsException | Condition |
---|
ArgumentException | If elements contains cyclical dependencies or a dependency that does not exist in elements. |
RemarksA dependency collection can be empty or to indicate no dependency.
See Also