algorithms/dijkstra 问题修复 & 功能扩展

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

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

algorithms/dijkstra

最新稳定版本:v3.0.1-alpha.1

Composer 安装命令:

composer require algorithms/dijkstra

包简介

Implementation of Dijkstra's algorithm.

README 文档

README

My implementation of famous the algorithm for finding the shortest paths in a graph. Discovered by Edsger Dijkstra.

Composer

Use in your console

composer require phpalgorithms/dijkstra

How to use

Create connections between points

    $dijkstra = new \PHPAlgorithms\Dijkstra(function (\PHPAlgorithms\Dijkstra\Creator $creator) {
        $creator->addPoint('start');

        $creator->addPoint('another one')
                ->addDoubleRelation($creator->getPoint(0), 10)
                ->addRelation($creator->addPoint(), 3);
    });

Generate paths from first point

    [...]

    print_r($dijkstra->generate(0)); // \PHPAlgorithms\Dijkstra\Path object

Generate paths for all points

    [...]

    print_r($dijkstra->generateAll()); // array of \PHPAlgorithms\Dijkstra\Path objects

Path object important parameters

    [...]

    print_r($pathObj->distance); // how is the path long
    print_r($pathObj->nodes); // all points in this path

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-10-01