public function done()
    {
        $graph = clone $this->graph;

        foreach ($this->nodeFactories as $factory) {
            if (!$factory->isValid()) {
                throw new LackOfCoffeeException(
                    vsprintf(
                        'Definition for the node "%s" is invalid.',
                        [$factory->getName()]
                    )
                );
            }

            $graph->add(
                $factory->getName(),
                $factory->getDependencies(),
                $factory->getSpec()
            );
        }

        return $graph;
    }