Пример #1
0
        public void TestTopSort()
        {
            TopSort <string> topSort = new TopSort <string>();

            string          graphString = @"
C-A,B
B-D
A-D
E-A,D,F
D-G,H
F-K,J
G-I
H-I,J
I-L
J-L,M
K-J
L-
M-";
            IGraph <string> graph       = ReadDirectedGraphFromString(graphString);

            IList <Vertex <string> > topologicalOrder = topSort.GetTopologicalOrder(graph);

            Assert.Equal("E", topologicalOrder[0].Value);
            Assert.Equal("L", topologicalOrder[11].Value);
            Assert.Equal("M", topologicalOrder[12].Value);
        }
Пример #2
0
    public static void Main()
    {
        TopSort srt = new TopSort();

        srt.Test();
    }