cmcdota/php-graph-to-svg
最新稳定版本:v1.0.7
Composer 安装命令:
composer require cmcdota/php-graph-to-svg
包简介
Compiles SVG graph based on force-directed layout Fruchterman-Reingold Algorithm.
README 文档
README
Simple realisation of Force-Directed Fruchterman–Reingold algorithm.
Special Thanks to Philipp Kindermann.
Installation
Install the latest version with
$ composer require cmcdota/php-graph-to-svg
Basic Usage
use Cmcdota\PhpGraphToSvg\Board; //Describe Vertexes and their edges (links) $vertexes = [ 0 => ['name' => '0', 'fill'=> '80ff80', 'edges' => [1]], 1 => ['name' => '1','fill'=> 'c0c0c0', 'edges' => [2]], 2 => ['name' => '2', 'edges' => [3]], 3 => ['name' => '3', 'edges' => [1]], 5 => ['name' => '5', 'edges' => [0]], 6 => ['name' => '6', 'edges' => [5]], 7 => ['name' => '7', 'edges' => [6,3]], 8 => ['name' => '8', 'edges' => [6,7]], 9 => ['name' => '9', 'edges' => [5]], 10 => ['name' => '10', 'edges' => [9]], 11 => ['name' => '11', 'edges' => [10,8]], 12 => ['name' => '12', 'edges' => [9,11]], ]; $board = new Board($vertexes, $params); echo "<html lang='EN'>"; for ($i = 1; $i <= 10; $i++) { $svg = $board->renderSVG(); file_put_contents("step$i.svg", $svg); echo "<div style='width:50%'><img src='step$i.svg' alt='next step' border='1'></div>"; $board->calculateAndMove(10); }
Results for Random
Start with random coordinates:

Results for Circle
$params=[ 'randomSpawn' => false ];
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2023-02-13


