Gets a valid commit order for all current nodes.

Uses a depth-first search (DFS) to traverse the graph.
The desired topological sorting is the reverse postorder of these searches.

@return array The list of ordered classes.
544183
public function getCommitOrder()
    {
        // Check whether we need to do anything. 0 or 1 node is easy.
        $nodeCount = count($this->_classes);

        if ($nodeCount <= 1) {
            return ($nodeCount == 1) ? array_values($this->_classes) : array();
        }

        // Init
        foreach ($this->_classes as $node) {
            $this->_nodeStates[$node->name] = self::NOT_VISITED;
        }

        // Go
        foreach ($this->_classes as $node) {
            if ($this->_nodeStates[$node->name] == self::NOT_VISITED) {
                $this->_visitNode($node);
            }
        }

        $sorted = array_reverse($this->_sorted);

        $this->_sorted = $this->_nodeStates = array();

        return $sorted;
    }
761314
public function get_order_master_collections()
    {
        $baseIds = $this->getOrderMasterCollectionsBaseIds();

        $collectionReferences = $this->app['repo.collection-references']->findHavingOrderMaster($baseIds);
        $groups = new CollectionReferenceCollection($collectionReferences);

        $collections = [];

        foreach ($groups->groupByDataboxIdAndCollectionId() as $databoxId => $group) {
            foreach ($group as $collectionId => $index) {
                $collections[$index] = \collection::getByCollectionId($this->app, $databoxId, $collectionId);
            }
        }

        ksort($collections);

        return $collections;
    }
618275
protected function sortResolvers()
    {
        $sortedResolvers = array();
        krsort($this->resolvers);

        foreach ($this->resolvers as $resolvers) {
            $sortedResolvers = array_merge($sortedResolvers, $resolvers);
        }

        return $sortedResolvers;
    }
840966
private function getCommitOrder(): array
    {
        static $calculator = null;
        if (null === $calculator) {
            $calculator = new CommitOrderCalculator();
        }

        $objects = array_merge($this->documentInsertions, $this->documentUpdates, $this->documentDeletions);

        $classes = [];
        foreach ($objects as $object) {
            $metadata = $this->manager->getClassMetadata(get_class($object));

            $calculator->addClass($metadata);
            $classes[$metadata->getName()] = $metadata;
        }

        $order = $calculator->getOrder(array_keys($classes));

        return array_map(function (array $element) {
            return $element[0]->getClassName();
        }, $order);
    }
909424
public List<FacesConfigAbsoluteOrderingType<FacesConfigType<T>>> getAllAbsoluteOrdering()
   {
      List<FacesConfigAbsoluteOrderingType<FacesConfigType<T>>> list = new ArrayList<FacesConfigAbsoluteOrderingType<FacesConfigType<T>>>();
      List<Node> nodeList = childNode.get("absolute-ordering");
      for(Node node: nodeList)
      {
         FacesConfigAbsoluteOrderingType<FacesConfigType<T>>  type = new FacesConfigAbsoluteOrderingTypeImpl<FacesConfigType<T>>(this, "absolute-ordering", childNode, node);
         list.add(type);
      }
      return list;
   }
1059242
public function sort()
    {
        foreach ($this->nodeList as $definition) {
            if ($definition->state !== Vertex::NOT_VISITED) {
                continue;
            }

            $this->visit($definition);
        }

        $sortedList = $this->sortedNodeList;

        $this->nodeList       = [];
        $this->sortedNodeList = [];

        return $sortedList;
    }
972880
public function getCommitActivity(): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/repos/:owner/:repo/stats/commit_activity',
            $this->getRepositories()->getOwner(), $this->getRepositories()->getRepo()));
    }
598657
public function findDescendants()
    {
        return static::where($this->getTreeColumn('path'), 'LIKE', $this->{$this->getTreeColumn('path')} . '%')
            ->orderBy($this->getTreeColumn('level'), 'ASC');
    }
1360621
public function index(): array {
        list($indexed, $commited) = $this->__index();

        $this->indexedRes  = array();
        $this->commitedRes = array();
        return $indexed;
    }
364131
public function findUnreachableStates(): array
	{
		$g = new Graph();
		$g->indexNodeAttr('unreachable');

		$g->createNode('', ['unreachable' => false]);
		foreach ($this->states as $s => $state) {
			if ($s !== '') {
				$g->createNode($s, ['unreachable' => true]);
			}
		}

		foreach ($this->actions as $a => $action) {
			foreach ($action['transitions'] ?? [] as $source => $transition) {
				foreach ($transition['targets'] ?? [] as $target) {
					$g->createEdge(null, $g->getNode($source), $g->getNode($target), []);
				}
			}
		}

		GraphSearch::DFS($g)
			->onNode(function (Node $node) use ($g) {
				$node->setAttr('unreachable', false);
				return true;
			})
			->start([$g->getNode('')]);

		return array_map(function(Node $n) { return $n->getId(); }, $g->getNodesByAttr('unreachable', true));
	}
197569
public function getOrdered()
    {
        if (!$this->sort) {
            return $this->content;
        }

        $unordered = [];
        foreach ($this->content as $content) {
            $unordered[$content->getId()] = $content;
        }

        $ordered = [];
        $sort = json_decode($this->sort, true);
        $order = $sort['order'];
        foreach ($order as $id) {
            if (isset($unordered[$id])) {
                $ordered[] = $unordered[$id];
            }
        }

        return $ordered;
    }
892148
public function getDefaultSorting()
    {
        $aSorting = parent::getDefaultSorting();

        $oCategory = $this->getActiveCategory();

        if ($this->getListType() != 'search' && $oCategory && $oCategory instanceof \OxidEsales\Eshop\Application\Model\Category) {
            if ($sSortBy = $oCategory->getDefaultSorting()) {
                $sSortDir = ($oCategory->getDefaultSortingMode()) ? "desc" : "asc";
                $aSorting = ['sortby' => $sSortBy, 'sortdir' => $sSortDir];
            }
        }

        return $aSorting;
    }
526547
public function getSortedRefs()
    {
        $versions = $this->versions;

        usort($versions, function (version $v1, version $v2) {


            return version::gt($v1, $v2) ? -1 : 1;
        });

        $versions = array_map(function (version $v) {


            return $v->getVersion();
        }, $versions);

        return array_merge($this->branches, $versions);
    }
1018940
public function getAlternatingSequence()
    {
        $edges    = $this->edges->getVector();
        $vertices = $this->vertices->getVector();

        $ret = array();
        for ($i = 0, $l = count($this->edges); $i < $l; ++$i) {
            $ret []= $vertices[$i];
            $ret []= $edges[$i];
        }
        $ret[] = $vertices[$i];

        return $ret;
    }
874502
function sort()
    {
        $rootNodes = $this->getRootNodes();

        $sorted = array();
        while ( count( $this->nodes ) > 0 ) {
            // check for circular reference
            if ( count( $rootNodes ) === 0 )
                return false;

            // remove this node from rootNodes and add it to the output
            $current = array_shift( $rootNodes );
            $sorted[] = $current->name;

            // for each of its children queue the new node and remove the original
            while ( $child = $current->popChild() )
            {
                $child->unregisterParent( $this->nodes[$current->name] );
                // if this child has no more parents, add it to the root nodes list
                if ( $child->parentCount() === 0 )
                    $rootNodes[] = $child;
            }

            unset( $this->nodes[$current->name] );
        }
        return $sorted;
    }
100515
private function getSortedSteps()
    {
        $sortedSteps = array();
        ksort($this->steps);

        foreach ($this->steps as $steps) {
            $sortedSteps = array_merge($sortedSteps, $steps);
        }

        return $sortedSteps;
    }
131620
public function getOrderedItems()
    {
        if (config('menus.ordering') || $this->ordering) {
            return $this->toCollection()->sortBy(function ($item) {
                return $item->order;
            })->all();
        }

        return $this->items;
    }