Beispiel #1
0
 protected void ProcessFinished()
 {
     while (finished.Count > 0)
     {
         NodeType start = finished.Pop();
         if (dfsBackward.IsVisited[start] == VisitState.Unvisited)
         {
             OnBeginComponent();
             dfsBackward.SearchFrom(start);
             OnEndComponent();
         }
     }
 }
Beispiel #2
0
 public void SearchFrom(NodeType start)
 {
     IsStrong = true;
     dfs.SearchFrom(start);
     if (time < graph.Nodes.Count)
     {
         IsStrong = false;
     }
     if (!IsStrong)
     {
         RedundantEdges.Clear();
     }
 }
Beispiel #3
0
        /// <summary>
        /// Invoke DFS on a graph node or group.
        /// If the node/group is in a group, then search from that group first (to ensure all predecessors of the group are scheduled),
        /// then search from the node, placing the node's results (which must all be within the group) on that group's schedule.
        /// </summary>
        /// <param name="node">Node in g</param>
        /// <param name="scheduleOfGroup">Holds schedule of each group (modified on exit)</param>
        private void SearchFrom(NodeIndex node, Dictionary <NodeIndex, List <NodeIndex> > scheduleOfGroup)
        {
            // first search from all groups of this node
            NodeIndex group = groupOf[node];

            if (group != -1)
            {
                SearchFrom(group, scheduleOfGroup);
            }
            if (!scheduleOfGroup.TryGetValue(group, out groupSchedule))
            {
                groupSchedule          = new List <NodeIndex>();
                scheduleOfGroup[group] = groupSchedule;
            }
            dfsScheduleWithGroups.SearchFrom(node);
        }
Beispiel #4
0
 public void SearchFrom(IEnumerable <NodeType> starts)
 {
     dfs.SearchFrom(starts);
 }