public function numberOfSubGraph(): int {
        if (null === $this->getNodes()) return 0;
        $c = 0;
        $v = new ArrayList();

        foreach ($this->getNodes() as $node) {
            if ($v->containsValue($node)) continue;
            $c++;
            $this->flood($node, $v);
        }
        return $c;
    }