Exemple #1
0
        public static WeightedAcyclicDirectedGraph <T> Create(
            WeightedDirectedGraph <T> digraph)
        {
            // Calc the depth of each node in the digraph.
            GraphDepthInfo depthInfo = AcyclicGraphDepthAnalysis.CalculateNodeDepths(digraph);

            return(CreateInner(digraph, depthInfo));
        }
Exemple #2
0
        public static WeightedAcyclicDirectedGraph <T> Create(
            WeightedDirectedGraph <T> digraph,
            GraphDepthInfo depthInfo)
        {
            // Assert that the passed in depth info is correct.
            // Note. This test is expensive because it invokes a graph traversal algorithm to determine node depths.
            Debug.Assert(depthInfo.Equals(AcyclicGraphDepthAnalysis.CalculateNodeDepths(digraph)));

            return(CreateInner(digraph, depthInfo));
        }