public static IVertex[] Sort(IVertex[] graphNodes) { ColorsSet colors = new ColorsSet(graphNodes); TimestampSet discovery = new TimestampSet(); TimestampSet finish = new TimestampSet(); LinkedList<IVertex> list = new LinkedList<IVertex>(); int time = 0; foreach(IVertex node in graphNodes) { if (colors.ColorOf(node) == VertexColor.White) { Visit(node, colors, discovery, finish, list, ref time); } } IVertex[] vertices = new IVertex[list.Count]; list.CopyTo(vertices, 0); return vertices; }