Exemple #1
0
        public int[] GetLayers()
        {
            List <IEnumerable <int> > comps = new List <IEnumerable <int> >(ConnectedComponentCalculator <IntEdge> .GetComponents(graph));

            if (comps.Count == 1)
            {
                NetworkSimplex ns = new NetworkSimplex(graph, this.Cancel);
                return(ns.GetLayers());
            }
            List <Dictionary <int, int> > mapToComponenents = GetMapsToComponent(comps);

            int[][] layerings = new int[comps.Count][];

            for (int i = 0; i < comps.Count; i++)
            {
                BasicGraph <Node, IntEdge> shrunkedComp = ShrunkComponent(mapToComponenents[i]);
                NetworkSimplex             ns           = new NetworkSimplex(shrunkedComp, Cancel);
                layerings[i] = ns.GetLayers();
            }

            return(UniteLayerings(layerings, mapToComponenents));
        }
        public int[] GetLayers()
        {
            NetworkSimplex ns = new NetworkSimplex(graph, this.Cancel);

            return(ns.GetLayers());
        }