GraphYEd extends graphp/graphml for supporting yEd file format for GraphML.
It provides access to the vertices (or nodes) and edges labels :
$vertex->getAttribute('labels')
$edge->getAttribute('labels')
Please refer to GraPHP library for more details on how to manipulate graphs.
The recommended way to install this library is through Composer.
$ composer require edno/graphyed
The method getAttribute('labels')
will return an array of type string.
<?php
$loader = new \edno\GraphYEd\Loader();
$graphml = file_get_contents('mygraph.graphml');
$graph = $loader->loadContents($graphml);
foreach($graph->getVertices() as $vertex) {
print($vertex->getAttribute('labels')[0]);
}
Released under the terms of the permissive MIT license.