C# Class Microsoft.CodeAnalysis.TopologicalSort

A helper class that contains a topological sort algorithm.
Mostra file Open project: stark-lang/stark-roslyn

Public Methods

Method Description
IterativeSort ( IEnumerable nodes, Func successors ) : ImmutableArray

Produce a topological sort of a given directed acyclic graph, given a set of nodes which include all nodes that have no predecessors. Any nodes not in the given set, but reachable through successors, will be added to the result. This is an iterative rather than recursive implementation, so it is unlikely to cause a stack overflow.

Private Methods

Method Description
PredecessorCounts ( IEnumerable nodes, Func successors, ImmutableArray &allNodes ) : int>.PooledDictionary

Method Details

IterativeSort() public static method

Produce a topological sort of a given directed acyclic graph, given a set of nodes which include all nodes that have no predecessors. Any nodes not in the given set, but reachable through successors, will be added to the result. This is an iterative rather than recursive implementation, so it is unlikely to cause a stack overflow.
public static IterativeSort ( IEnumerable nodes, Func successors ) : ImmutableArray
nodes IEnumerable Any subset of the nodes that includes all nodes with no predecessors
successors Func A function mapping a node to its set of successors
return ImmutableArray