public function testGettingAllAttributesReturnsKeyedArrayWithKeysPrependedWithGraphviz()
 {
     $this->sut->set(new StringType('style'), new StringType('regular'))->set(new StringType('color'), new StringType('red'));
     $test = $this->sut->getAttributes();
     $this->assertArrayHasKey('graphviz.style', $test);
     $this->assertArrayHasKey('graphviz.color', $test);
 }
 public function testYouCanRenderAValidNumericMatrixThatDescribesAGraph()
 {
     $csv = explode(PHP_EOL, $this->getData());
     $m = [];
     $attribs = [];
     foreach ($csv as $line) {
         $values = str_getcsv($line);
         $attr = new VertexDescription(new StringType(array_shift($values)));
         $attr->set(new StringType('fillcolor'), new StringType('white'))->set(new StringType('style'), new StringType('filled,solid'));
         if ($attr->getName() == 'I') {
             $attr->set(new StringType('fillcolor'), new StringType('green'));
         }
         if ($attr->getName() == 'H') {
             $attr->set(new StringType('fillcolor'), new StringType('red'));
         }
         if (in_array($attr->getName(), ['A', 'B', 'C', 'D', 'E', 'F'])) {
             $attr->set(new StringType('fillcolor'), new StringType('yellow:green'));
         }
         array_shift($values);
         //remove name
         $m[] = array_map(function ($item) {
             //convert weights to integer
             return intval(floatval($item * 100));
         }, $values);
         $attribs[] = $attr;
     }
     $attribCollection = new Collection($attribs);
     $markov = new NumericMatrix($m);
     $test = $this->sut->format($markov, ['attribs' => $attribCollection, 'edgeFunc' => function ($w) {
         return $w / 100;
     }]);
     $this->assertEquals($this->getRenderResult(), $test);
 }