SHARE
TWEET

Untitled

a guest Feb 14th, 2020 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     function makeGraph(&$graph, $tree, $parent = null, $edge_label = "") {
  2.         $main = $graph->createVertex();
  3.         $main->setAttribute('graphviz.label', $tree->getAttributeName());
  4.         if($parent) {
  5.             $edge = $parent->createEdgeTo($main);
  6.             $edge->setAttribute('graphviz.label', $edge_label);
  7.         }
  8.         foreach ($tree->values as $key => $child) {
  9.             if ($child->getIsLeaf()) {
  10.                 $first_level_child = $graph->createVertex();                
  11.                 $edge = $main->createEdgeTo($first_level_child);
  12.                 $edge->setAttribute('graphviz.label', $key);
  13.                 if($child->getChild('result') == 'true') {
  14.                     $first_level_child->setAttribute('graphviz.color', 'green');
  15.                     $first_level_child->setAttribute('graphviz.label', $child->getAttributeName());
  16.                 } else {
  17.                     $first_level_child->setAttribute('graphviz.color', 'red');
  18.                     $first_level_child->setAttribute('graphviz.label', "nie ".$child->getAttributeName());
  19.                 }
  20.             } else {
  21.                 makeGraph($graph, $child, $main, $key);
  22.             }
  23.         }
  24.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top