graphp/trivial-graph-format 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

graphp/trivial-graph-format

最新稳定版本:v0.1.1

Composer 安装命令:

composer require graphp/trivial-graph-format

包简介

Trivial Graph Format (TGF) is a simple text-based file format for describing graphs

README 文档

README

CI status

Trivial Graph Format (TGF) is a simple text-based file format for describing graphs.

Note: This project is in beta stage! Feel free to report any issues you encounter.

Table of contents

Usage

TrivialGraphFormat

getOutput()

The getOutput(Graph $graph): string method can be used to export the given graph instance.

$graph = new Fhaculty\Graph\Graph();

$a = $graph->createVertex('a');
$b = $graph->createVertex('b');
$a->createEdgeTo($b);

$exporter = new Graphp\TrivialGraphFormat\TrivialGraphFormat();
$data = $exporter->getOutput($graph);

file_put_contents('example.tgf', $data);
echo $data;

The TGF output will look something like this:

1 a
2 b
#
1 2

This method only supports exporting the basic graph structure, with all vertices and directed and undirected edges.

Note that TGF does not support the notion of directed and undirected edges. As such, this method will print two edges in opposite directions for any undirected edges.

Note that TGF does not support the notion of structured attributes. As such, this method will print the mathematical attributes as vertex and edge labels as appropriate.

Install

The recommended way to install this library is through composer. New to composer?

{
    "require": {
        "graphp/trivial-graph-format": "~0.1.0"
    }
}

This project aims to run on any platform and thus does not require any PHP extensions and supports running on legacy PHP 5.3 through current PHP 7+ and HHVM. It's highly recommended to use PHP 7+ for this project.

Tests

To run the test suite, you first need to clone this repo and then install all dependencies through Composer:

$ composer install

To run the test suite, go to the project root and run:

$ php vendor/bin/phpunit

License

Released under the terms of the permissive MIT license.

统计信息

  • 总下载量: 3.53k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-02-24