Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

subgraph/cluster and class count #42

Closed
llaville opened this issue Apr 3, 2020 · 5 comments
Closed

subgraph/cluster and class count #42

llaville opened this issue Apr 3, 2020 · 5 comments

Comments

@llaville
Copy link

llaville commented Apr 3, 2020

Hello,

i'm currently working on a PHP solution based on your packages (here are my versions used)

graphp/graph                       dev-master 0d78233 GraPHP is the mathematical graph/network library written in PHP.
graphp/graphviz                    dev-master 5ad4f5d GraphViz graph drawing for the mathematical graph/network library GraPHP.

I've recently be aware that when there are many classes in a diagram, subgraph even with a single class, are displayed correctly.

But when there is only one namespace and one class, such as :

<?php
declare(strict_types=1);

namespace App;

class BackupProject
{
    private $a;
    private const B = 'b';
    public function __construct(string  $a)
    {
        $this->a = $a;
    }
}

subgraph is not generated and give such result :

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGEAAABRCAIAAABNHl9ZAAAABmJLR0QA/wD/AP+gvaeTAAAKNklEQVR4nO2cfVSM2x7Hfz3TmMRgjW6XKGWa6MWKJJWWSOU96Y04klZLpZiG1TJqSWJphCPFic6SXuagNGLUrHGijrKampJS9+iFlNdIs67lUjPVdP94rufMnUnPUCrO8/lr9p7927/vfGc/e+9nZvZo9PX1AcGAICMt4DuA8AgfwiN8CI/w0VQq//xzrEhUNiJSRhPjdu/ebWdnhxaUPRKJykpLa6ytrYdd1iiCz8/x9vb+rEcAYG1tnZaWNqyiRhk0Gk2xSMxH+OB71NzcTPuEnp6eq6vrw4cP1ew9Pz+fRqPV1tZ+hTKlvN7e3u3t7bhRd+/epdFoZWVqTakymezo0aNisXjgZuqOo/Xr158+ffrgwYOtra2RkZFqRg0eNG9oaGhhYSGHw8HqP3d7YGJicvr0aTqdrk7n3d3dQ+nRrFmzli9fvmLFCl1dXSqVCgByuZzFYhkZGRkYGAQEBEilUg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ce/kyYhp03TPnNkHAHl5JTzeCU/PZbiJsKj37z90dcnGjqWgzeztLQsK1P2rh2G61m7fLvf3dyOREAbD4N69S8XFVdu2rSORkKlTdZYts6mo+BcArFy5aOLE8WPHUvT0/tHZKV2wwPzGjeLo6F+o1HFMpq9ib6tWOZiaGqmTCKtvbX01ZcpkrDhtmu7jx8/VFK+uR5mZ+XZ2fqGhcSkpPDs7v4iIk2oGovT2ytEDdQDw5o1EcS7Q0NBAi9raWoohDg5zxWKuiYlhfHxaYOBBxaeoVG1QAf0y/XOJlI5xozeraopX16MtW1aLRBlnzuzbvt1TJMo4doylZiDK4sXzudz8vr6+lpaXLi7BS5ZYp6ff6O2Vv3r1tqCgzMamn5+Ds9mnEhMv/vTTKg5nV2XlnwAglyu/Ki2tMS0tLwHg/v36hoYW1UQIgqBRhoZT0Ssa5eXLdjp9uprih+lslp/fmqqqP2fPXk8mayYnR7m42FZVPTQz8yCRkKNHw6dO1VENCQ3duHHj3suXb5JISEJCBIVCptEm+PtHOzvbYm1cXe0SEy/OnbvBwsLY0XG+aiIsKi0tVktrTGenFJ2SRKIHLi52qkn7pZ9zkD/qZyNcrkBDAzZvXgUAa9cyr18/iZ7LVgVBrBTPQQ52HLW0vDxzJkupRkuLojhBAsCePX5KNcOPr++K7dtjfX1X5OYWBQS4f84gVQbrkaGh3pfOTSMFiYScPx8DAP1uGgbgu9lnjyCER/gQHuFDeIQP4RE+hEf4qK7943JychDEagS0jFaU99kikQj776G/M/b29tOn/++GTtkjAlWI+QgfwiN8/gvdlKwrNDEEfQAAAABJRU5ErkJggg==

Statements code corresponding to this image are :

graph {
  graph [name="G" overlap="false"]
  node [fontname="Verdana" fontsize=8 shape="none" margin=0 fillcolor="#FEFECE" style="filled"]
  edge [fontname="Verdana" fontsize=8]
  "App\\BackupProject" [label=<
<table cellspacing="0" border="0" cellborder="1">
    <tr><td bgcolor="#eeeeee"><b>BackupProject</b></td></tr>
    <tr><td><table border="0" cellspacing="0" cellpadding="2">
<tr><td align="left">- a</td></tr>
</table></td></tr>
    <tr><td><table border="0" cellspacing="0" cellpadding="2">
<tr><td align="left">+ __construct()</td></tr>
</table></td></tr>
</table>> shape="none"]
}

While I'm expected to see the rectangle that show the namespace as follow

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAI0AAACbCAYAAABf0RgjAAAABmJLR0QA/wD/AP+gvaeTAAAPCklEQVR4nO3de1SU1b/H8TczIqRyfi7ydH5psFAEUynLDMVcYiVamqYieE3F5QoNCyFJwiWaunKkNEEN5aR5QQ0ENRKiH15SzFFQw+T8QvGa5iV/1HF5lKs8548OcyQQ2Q4MA3xfa7HWOM9+9t4z83HPfmbm2Y+NpmkaQijQNXQHROMjoRHKJDRCmYRGKJPQCGUSGqFMQiOUSWiEMgmNUCahEcokNEKZhEYok9AIZRIaoayFOTsvX74co9FYV30RFrR9+/ZH3teskcZoNHLkyBFzqhAWduXKFZKSksyqw6yRBqBPnz5mpVZYVmJiImPGjDGrDpnTCGUSGqFMQiOUSWiEMgmNUNYsQzNs2DBu3LjR0N1otJpdaM6dO0dqaipr165t6K40Ws0uNGvWrMHW1pa1a9dSVlbW0N1plJpVaIqLi/n++++ZPXs2V69eZceOHQ3dpUapWYUmMTGRkSNHEhgYiE6nY+XKlVXK3Lhxg5iYGHr06EF+fj7+/v60bt2aTp06kZycXOsyTZpmhtGjR2ujR482pwqL6t+/v3bt2jVN0zRt6NChGqDl5ORUKvPDDz9o3t7eGqAFBARoGRkZ2o4dOzQnJydNr9drubm5tSpjrRISEjQzX3at2YQmJyenUl9TUlI0QJs2bVqVspGRkRpgCpimaVpmZqYpJLUtY43qIjTN5u0pNjaWwMBA07+HDBmCk5MTW7Zs4Y8//qhU1sbGBgB7e3vTff369eOpp57i1KlTtS7TVJn9LXdjcPv2bZKSkjAajaYXG/6cGBcWFrJu3Tpmz5790HqcnZ35/fffzS7T2DWLkWbz5s3MmjWLkydPkpOTY/o7dOgQNjY2fP7555SXlz+0nrt379K5c2ezyzR2TT40m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8Njj9nRvv2/U1hYzIsvduebbw4SGfk5Dg6tCQ4eV6WdIUP60bVrR+W+3O/SpWv8/e+PV7qvQ4cnOHfuipnPQt2yqtBs3pyKl9ckgoKWEBeXjJfXJMLCPjOrznv3yk0X2AL47bffq8wRbGxsTPe1amVfpY5+/Z4jKysed3cXoqI2MG3aR1XKODi0qnJfhYpTiB/Wl+qupqNpmlmX2akPVhWat94aitG4idWrP+Ttt30xGjfxySchZtXZv/8LxMenomkaFy9excdnOgMG9GLjxm+4d6+ca9f+RUbGETw9H7y2cXh4NDExW5k4cQgGw3scO/ZPAMrLq38x7e1bcvHiVQB+/DGP06cvPrAvOp3OVI+Ly5Omt8kKV6/exNX1KbOeg7rWaE6We1STJr3BiRP/5OmnR2Jr24LY2Ln4+PThxImf6dZtFHq9jqVLZ/Hkk+0eWEdQ0FjGjp3DV199h16vY8WKMOzsbHF0/DemTIlk4MA+lcoPGuRFTMxWnntuDB4enfH2fuGBfbm/ng0bFmJv35LCwmLTvMZo/AkfH8t8e11bFr+ynPw0ombx8WnY2MCECUMAGDYsmK+//uyhl0XU6Xpa7MpyjWqkuXjxKqtXJ1R7v729XZVJJMD770+q9n5rNW7ca7z99kLGjXuNnTv3M3XqCOXraNa3RhUaF5f2Zs9xrJ1er2PdugUANR6+NyTrirBoFCQ0QpmERiiT0AhlEhqhTEIjlFn4kLs1SUlJ6HQ9LdusqFMWDU1oaKjpU2RR9/r27WuRdiwaGi8vL4udBSjqj8xphDIJjVAmoRHKJDRCmYRGKJPQCGUSGqHM7M9pkpKSsLGxqYu+iEbCrN8IG41GLl++XJf9ERbysN8S18Ss0IjmSeY0QpmERiiT0AhlEhqhTEIjlElohDIJjVAmoRHKJDRCmYRGKJPQCGUSGqFMQiOUtQBqt/aZEP/nfwEbb3CrZc/YtgAAAABJRU5ErkJggg==

Statements code corresponding to this image are :

graph {
  graph [name="G" overlap="false"]
  node [fontname="Verdana" fontsize=8 shape="none" margin=0 fillcolor="#FEFECE" style="filled"]
  edge [fontname="Verdana" fontsize=8]
  subgraph cluster_0 {
    label = "App"
    "App\\BackupProject" [label=<
<table cellspacing="0" border="0" cellborder="1">
    <tr><td bgcolor="#eeeeee"><b>BackupProject</b></td></tr>
    <tr><td><table border="0" cellspacing="0" cellpadding="2">
<tr><td align="left">- a</td></tr>
</table></td></tr>
    <tr><td><table border="0" cellspacing="0" cellpadding="2">
<tr><td align="left">+ __construct()</td></tr>
</table></td></tr>
</table>> shape="none"]
  }
}

To produce such result, i've just changed one line in your code : https://github.com/graphp/graphviz/blob/master/src/GraphViz.php#L283

if (count($groups) > 0) {

Tell me what you think, and if you're agree with this change !

Thanks
Laurent

@llaville
Copy link
Author

@clue hello.
Do you have time to have a look on this suggestion ?

@clue
Copy link
Member

clue commented Apr 21, 2020

@llaville Thanks for reporting, it looks like you've spotted a missing feature / a minor bug!

I agree that we should draw a subgraph if only one group has been assigned explicitly. On top of this, we should not draw a subgraph if only one group has been assigned implicitly (all vertices are in the null group by default).

Adding this shouldn't be too hard. I'll take a look at this again before the next release is tagged, PRs are very welcome in case anybody beats me to it 👍

@llaville
Copy link
Author

llaville commented Jan 1, 2022

@clue Here is the final patch I used with cweagans/composer-patches to modify your package on installation to add this new feature !

diff --git a/src/GraphViz.php b/src/GraphViz.php
index 9d6d8a0..5d8a530 100644
--- a/src/GraphViz.php
+++ b/src/GraphViz.php
@@ -280,13 +280,29 @@ class GraphViz
         }

         // only cluster vertices into groups if there are at least 2 different groups
-        if (count($groups) > 1) {
+        if (count($groups) > 0) {
+            // add subgraph cluster attributes
+            $clusters = array(
+                'graph' => 'graphviz.cluster.%s.graph.',
+                'node'  => 'graphviz.cluster.%s.node.',
+                'edge'  => 'graphviz.cluster.%s.edge.',
+            );
             $indent = str_repeat($this->formatIndent, 2);
             $gid = 0;
             // put each group of vertices in a separate subgraph cluster
             foreach ($groups as $group => $vertices) {
-                $script .= $this->formatIndent . 'subgraph cluster_' . $gid++ . ' {' . self::EOL .
-                           $indent . 'label = ' . $this->escape($group) . self::EOL;
+                $script .= $this->formatIndent . 'subgraph cluster_' . $gid . ' {' . self::EOL;
+                foreach ($clusters as $key => $prefix) {
+                    foreach (array($group, $gid) as $clusterId) {
+                        $layout = $this->getAttributesPrefixed($graph, sprintf($prefix, $clusterId));
+                        if (!empty($layout)) {
+                            $script .= $indent . $key . ' ' . $this->escapeAttributes($layout) . self::EOL;
+                            break;
+                        }
+                    }
+                }
+                $script .= $indent . 'label = ' . $this->escape($group) . self::EOL;
+                $gid++;
                 foreach ($vertices as $vertex) {
                     $vid = $vids[\spl_object_hash($vertex)];
                     $layout = $this->getLayoutVertex($vertex, $vid);
@@ -320,7 +336,7 @@ class GraphViz

         // add all edges as directed edges
         foreach ($graph->getEdges() as $currentEdge) {
-            $both = $currentEdge->getVertices()->getVector();
+            $both = $currentEdge->getVertices();
             $currentStartVertex = $both[0];
             $currentTargetVertex = $both[1];

@llaville
Copy link
Author

This project seems unmaintained, and I'm not sure to want to keep a fork with patch. Perharps I'll create a new standalone project in future days to replace it.
Now I'll close this report as it seems your architecture (see relative ticket #14) is not yet ready.

@SimonFrings
Copy link
Contributor

@llaville This project is indeed maintained, @clue and I have over 100 open source projects to look over here on GitHub and we're currently a lot involved in working on ReactPHP. Even if we're currently not actively working on new features in this project doesn't mean we're not reviewing any suggestions made by contributors. If you need this urgently, you can also reach out to us or help us by becoming as sponsor

If you would like to add this new feature to the project you can also open up a pull request, just add the necessary tests to assure everything works as expected and we're happy to take a look 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants