public function toDot(callable $inOptDataToStringConverter=null) {

        if (is_null($inOptDataToStringConverter)) {
            $inOptDataToStringConverter = $this->__dataToStringConverter;
        }

        $data = [
            'nodes' => [],
            'edges' => []
        ];

        $toDot = function(Node $inNode, array &$inOutResult) use ($inOptDataToStringConverter) {
            // For every given node, we have its parent.

            $nodeId = spl_object_hash($inNode);
            $nodeLabel = $inOptDataToStringConverter($inNode->getData());
            $inOutResult['nodes'][] = '   "' . $nodeId . '" [label="' . $nodeLabel. '"];';

            if ($inNode->isRoot()) {
                return;
            }

            $parentId = spl_object_hash($inNode->getParent());
            $inOutResult['edges'][] = '   "' . $parentId . '" -> "' . $nodeId . '";';
        };

        $this->getRoot()->traverse($toDot, $data);
        $dot = ["digraph mytree {"];
        foreach ($data['nodes'] as $node) {
            array_push($dot, $node);
        }
        foreach ($data['edges'] as $edge) {
            array_push($dot, $edge);
        }
        array_push($dot, "}");
        array_push($dot, "/* Usage: dot -Tgif -Ograph graph.dot */");
        return implode("\n", $dot);
    }