phgraph/graph 问题修复 & 功能扩展

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

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

phgraph/graph

Composer 安装命令:

composer require phgraph/graph

包简介

Mathematical Graphing Library

README 文档

README

Build Status Coverage Status StyleCI Maintainability

phgraph/graph

PHGraph is a modern mathematical graph/network library written in PHP.

Installation

You can install the package via composer:

composer require phgraph/graph

Usage

Creation and Search

use PHGraph\Graph;
use PHGraph\Search\BreadthFirst;
…

$graph = new Graph;
$columbus = $graph->newVertex([
    'name' => 'Columbus',
]);
$cleveland = $graph->newVertex([
    'name' => 'Cleveland',
]);
$cincinnati = $graph->newVertex([
    'name' => 'Cincinnati',
]);

$columbus->createEdge($cleveland);
$columbus->createEdge($cincinnati);

$search = new BreadthFirst($cincinnati);
if ($search->hasVertex($cleveland)) {
    echo "We can get from Cincinnati to Cleveland\n";
} else {
    echo "We can’t get from Cincinnati to Cleveland\n";
}

Graph drawing

This library has support for visualizing graphs as images using GraphViz "Graph Visualization Software". You will need GraphViz installed on your system for this to work.

use PHGraph\Graph;
use PHGraph\GraphViz\GraphViz;
…

$graph = new Graph;
$columbus = $graph->newVertex([
    'name' => 'Columbus',
]);
$cleveland = $graph->newVertex([
    'name' => 'Cleveland',
]);
$cincinnati = $graph->newVertex([
    'name' => 'Cincinnati',
]);
$columbus->createEdge($cleveland);
$columbus->createEdge($cincinnati);

$graphviz = new GraphViz($graph);
// open the image on your system
$graphviz->display();

output:

display output

Algorithms

A graph library is rather boring without the ability to use algorithms on it, here is a list of the currently supported ones:

Development

Installing dependencies

You will need Composer for the development dependencies. Once you have that, run the following

$ composer install

Running tests

You can run the current test suite with the following command

$ composer test

For static analysis of the code run the following

$ composer analyse

Bug Reports

Bug reports for the current release version can be opened in this repository’s issue tracker.

Thanks

this was heavily inspired by graphp/graph.

统计信息

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

GitHub 信息

  • Stars: 13
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固