コード例 #1
0
        private ArrayList TopoSortAdjVertices(IVertex v, IIncidenceGraph g, VertexIntDictionary topo_ordering)
        //	return adjacent vertices to "v" sorted in topological order
        {
            IEdgeEnumerator it    = g.OutEdges(v).GetEnumerator();
            bool            valid = false;
            ArrayList       adj   = new ArrayList();

            while (it.MoveNext())
            {
                valid = true;
                adj.Add(it.Current.Target);
            }
            if (!valid)                         // no outgoing edges
            {
                return(adj);
            }
            CompareTopo ctopo = new CompareTopo(topo_ordering);
            SwapTopo    stopo = new SwapTopo();
            QuickSorter qs    = new QuickSorter(ctopo, stopo);

            qs.Sort(adj);
            return(adj);
        }
コード例 #2
0
 //    return adjacent vertices to "v" sorted in topological order
 private ArrayList TopoSortAdjVertices( IVertex v, IIncidenceGraph g, VertexIntDictionary topo_ordering )
 {
     IEdgeEnumerator it = g.OutEdges(v).GetEnumerator();
     bool valid = false;
     ArrayList adj = new ArrayList();
     while(it.MoveNext())	{
         valid = true;
         adj.Add(it.Current.Target);
     }
     if(!valid)		// no outgoing edges
         return adj;
     CompareTopo ctopo = new CompareTopo(topo_ordering);
     SwapTopo stopo = new SwapTopo();
     QuickSorter qs = new QuickSorter(ctopo, stopo);
     qs.Sort(adj);
     return adj;
 }
コード例 #3
0
 private ArrayList TopoSortAdjVertices(IVertex v, IIncidenceGraph g, VertexIntDictionary topo_ordering)
 {
     IEdgeEnumerator enumerator = g.OutEdges(v).GetEnumerator();
     bool flag = false;
     ArrayList list = new ArrayList();
     while (enumerator.MoveNext())
     {
         flag = true;
         list.Add(enumerator.get_Current().get_Target());
     }
     if (flag)
     {
         CompareTopo topo = new CompareTopo(topo_ordering);
         SwapTopo topo2 = new SwapTopo();
         new QuickSorter(topo, topo2).Sort(list);
     }
     return list;
 }