private function subgraphs($array, $level = 1, $nsname = '')
{
static $id = 0;
$r = '';
// Colors are managed with $level, thanks to colorscheme option.
foreach ($array as $key => $a) {
++$id;
if (is_int($key)) {
$r .= $a;
} else {
$r .= "subgraph cluster_{$id} { \nstyle=filled;\nlabel=\"{$nsname}{$key}\";\ncolor=\"{$level}\";\n";
$r .= $this->subgraphs($a, $level + 1, $nsname . '\\\\' . $key);
$r .= "}\n";
}
}
return $r;
}