定制 selcukmart/number-of-connected-groups-y42 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

selcukmart/number-of-connected-groups-y42

Composer 安装命令:

composer require selcukmart/number-of-connected-groups-y42

包简介

README 文档

README

composer require selcukmart/number-of-connected-groups-y42

Number of connected groups

There are two solutions in it. One of them is non-recursive(custom distance calculation between coordinates technic) only iterable, the other is a classic solution called Depth First Search (DFS) .

The code has unit tests. It can be tested after cloned.

tests/CountForIterativeTest.php
tests/CountForRecursiveTest.php

Iterative Example;

$matrix = [
[1, 1, 1, 0, 0],
[0, 0, 1, 0, 0],
[0, 0, 0, 1, 1],
[1, 0, 0, 0, 0],
[1, 0, 1, 0, 1]
];

$result = (new NumberOfConnectedGroupsIterative(5, 5))->countGroups($matrix);

The result will be 5 for only horizontal and vertical links.

DFS Example

$matrix = [
            [1, 1, 0, 0, 0],
            [0, 1, 0, 0, 1],
            [1, 0, 0, 1, 1],
            [1, 0, 0, 0, 0],
            [1, 0, 1, 0, 1]
        ];

        $result = (new NumberOfConnectedGroupsRecursive(5, 5))->countGroups($matrix);

The result will be 5 for only horizontal and vertical links.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-17

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固