Group the nodes by component.

@return array
325287
private function groupResults()
    {
        $result = array();
        foreach ($this->nodes as $node => $component) {
            if (array_key_exists($component, $result)) {
                $result[$component][] = $node;
            } else {
                $result[$component] = array($node);
            }
        }

        return $result;
    }
1152689
public function getComponents()
    {
        $components = [];

        foreach ($this->indexReverse[self::COMPONENT] as $index) {
            $components[] = $this->getChild($index);
        }

        return $components;
    }
311736
function byGroup() {
    var nodes = this.spawn();
    var edges = this.spawn();

    for (var i = 0; i < this.length; i++) {
      var ele = this[i];

      if (ele.isNode()) {
        nodes.merge(ele);
      } else {
        edges.merge(ele);
      }
    }

    return {
      nodes: nodes,
      edges: edges
    };
  }
1351018
public function allNodes()
    {
        $orderColumn = DB::getQueryGrammar()->wrap($this->orderColumn);
        $byOrder = $orderColumn.' = 0,'.$orderColumn;

        $self = new static();

        if ($this->queryCallback instanceof \Closure) {
            $self = call_user_func($this->queryCallback, $self);
        }

        return $self->orderByRaw($byOrder)->get()->toArray();
    }
316093
public function getGroups()
	{
		if (!is_array($this->_xml))
		{

			return false;
		}

		$results = array();
		foreach ($this->_xml as $name => $group)
		{
			$results[$name] = $this->getNumParams($name);
		}

		return $results;
	}
474755
public function toArrayNode() {
    return ($this->parent instanceof ArrayNode) ? clone $this->parent : Parser::parseExpression('[' . $this->getText() . ']');
  }
520710
public function getDataRows()
    {
        $list = array();
        foreach ($this->components as $child) {
            if ($child instanceof DataRow) {
                $list[] = $child;
            }
        }
        return $list;
    }
1138457
public function getComponents () : array
    {
        if (null === $this->components)
        {
            $this->components = $this->loader->loadComponents($this);
        }

        return $this->components;
    }
368640
public function children()
    {
        if (!$this->nodes) {
            throw new \InvalidArgumentException('The current node list is empty.');
        }

        $node = $this->getNode(0)->firstChild;

        return $this->createSubCrawler($node ? $this->sibling($node) : array());
    }
1318042
public function getGroups()
    {
        $groups = array();
        foreach ($this->graph->getVertices() as $vertex) {
            $groups[$vertex->getGroup()] = true;
        }

        return array_keys($groups);
    }
1055716
protected function get_component_list() {
        $components = array_keys(array_reduce(\core_component::get_component_list(), function($carry, $item) {
            return array_merge($carry, $item);
        }, []));
        $components[] = 'core';

        return $components;
    }
350731
public function getReducedTree()
    {
        $parseTree = function (Node $node, Node $target) use ( &$parseTree ) {
            if (substr($target->getPath(),0, strlen($node->getPath())) != $node->getPath()) {
                return array();
            }
            $tree = array();

            foreach ($node->getNodes() as $child) {
                $tree[] = array(
                    'name'          =>  $child->getName(),
                    'path'          =>  $child->getPath(),
                    'hasChildren'   =>  $child->hasNodes(),
                    'children'      =>  $parseTree($child, $target)
                );
            }

            return $tree;
        };

        $treeFactory = function($parent, $node) use ($parseTree) {
            return [ '/' => [
                'name'          =>  '/',
                'path'          =>  '/',
                'hasChildren'   =>  $parent->hasNodes(),
                'children'      =>  $parseTree($parent, $node)
            ]];
        };

        if ($this->getPath() == '/') {
            return $treeFactory($this, $this);
        }

        $parent = $this;
        do {
            $parent = $parent->getParent();
        } while ($parent->getPath() != '/');

        return $treeFactory($parent, $this);
    }
154247
public function getNodes()
    {
        $nodes = [];
        $data = $this->getState();

        foreach ($data['nodes'] as $id => $name) {
            $nodes[] = new Node($id, $this->getClient());
        }

        return $nodes;
    }
691781
public function toArray(){
		$array	= array();
		foreach( $this->data as $key => $node ){
			if( count( $node->data ) )
				$array[$key]	= $node->toArray();
			else
				$array[$key]	= $node->value;
		}
		return $array;
	}
94904
private function getRootNodes()
    {
        $output = array();
        foreach( $this->nodes as $node )
            if (! $node->parentCount() )
                $output[] = $node;
        return $output;
    }
442073
public function getAll() {
    if (is_null($this->components)) {
      $base_path = $this->getBaseComponentPath();

      $filter = function (Extension $module) use ($base_path) {
        return strpos($module->getPath(), $base_path) === 0;
      };

      $this->components = array_filter($this->discovery->scan('module'), $filter);
    }
    return $this->components;
  }
173126
public function children(): NodeList {
        $results = $this->collection()->reduce(function($carry, $node) {
            return $carry->merge(
                $node->findXPath('child::*')
            );
        }, $this->newNodeList());

        return $results;
    }