Skip to content

Consider adding a TopologicalSort function #628

@Treit

Description

@Treit

Supporting a Topological sort function could be useful.

I've seen an implementation having this signature in some other code:

/// <summary>
/// Topological Sorting (Kahn's algorithm)
/// </summary>
/// <remarks>https://en.wikipedia.org/wiki/Topological_sorting</remarks>
/// <typeparam name="T"></typeparam>
/// <param name="nodes">All nodes of directed acyclic graph.</param>
/// <param name="edges">All edges of directed acyclic graph.</param>
/// <returns>Sorted node in topological order.</returns>
public static List<T>? TopologicalSort<T>(HashSet<T> nodes, HashSet<Tuple<T, T>> edges) where T : IEquatable<T>

Not sure if this is a fit for SuperLinq, but maybe worth considering.

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions