Beispiel #1
0
        public override bool TransitiveReduction()
        {
            IDictionary <T, HashSet <T> > ancestorNodesLookup = GetAncestorNodesLookup();

            if (ancestorNodesLookup is null)
            {
                return(false);
            }
            foreach (T endNodeId in EndNodes.Select(x => x.Id))
            {
                RemoveRedundantIncomingEdges(endNodeId, ancestorNodesLookup);
            }
            return(true);
        }
Beispiel #2
0
        public override bool TransitiveReduction()
        {
            // For Arrow Graphs only dummy edges need to be reduced.
            IDictionary <T, HashSet <T> > ancestorNodesLookup = GetAncestorNodesLookup();

            if (ancestorNodesLookup is null)
            {
                return(false);
            }
            foreach (T endNodeId in EndNodes.Select(x => x.Id))
            {
                RemoveRedundantIncomingDummyEdges(endNodeId, ancestorNodesLookup);
            }
            return(true);
        }
Beispiel #3
0
        public IDictionary <T, HashSet <T> > GetAncestorNodesLookup()
        {
            if (!AllDependenciesSatisfied)
            {
                return(null);
            }
            IList <CircularDependency <T> > circularDependencies = FindStrongCircularDependencies();

            if (circularDependencies.Any())
            {
                return(null);
            }
            var nodeIdAncestorLookup = new Dictionary <T, HashSet <T> >();

            foreach (T endNodeId in EndNodes.Select(x => x.Id))
            {
                HashSet <T> totalAncestorNodes = GetAncestorNodes(endNodeId, nodeIdAncestorLookup);
                nodeIdAncestorLookup.Add(endNodeId, totalAncestorNodes);
            }
            return(nodeIdAncestorLookup);
        }