edno/graphyed

此包已被弃用且不再维护。未建议替代包。

GraphML库的扩展,支持yEd GraphML文件

0.2.1 2019-04-22 12:18 UTC

This package is auto-updated.

Last update: 2021-09-21 15:47:12 UTC


README

Packagist Latest Version Build Status Coverage Status GitHub license FOSSA Status

GraphYEd扩展graphp/graphml以支持yEd文件格式GraphML

它提供了访问顶点(或节点)和边标签的方法

  • $vertex->getAttribute('labels')
  • $edge->getAttribute('labels')

请参考GraPHP库以获取更多关于如何操作图的详细信息。

安装

推荐通过Composer安装此库。

$ composer require edno/graphyed

使用

方法getAttribute('labels')将返回一个字符串类型的数组

<?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]);
}

许可

在宽松的MIT许可证下发布。