PHPackages                             jciel/pgraph - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. jciel/pgraph

ActiveLibrary

jciel/pgraph
============

Biblioteca para trabalhar com grafos em PHP

251PHP

Since Apr 12Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Jciel/pgraph)[ Packagist](https://packagist.org/packages/jciel/pgraph)[ RSS](/packages/jciel-pgraph/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (2)Used By (0)

PGraph
======

[](#pgraph)

Library to work with Binary Search Tree (BST) and Binary Tree (BT) data structure in PHP. It is possible to work with scalar values and objects.

### Instalation

[](#instalation)

Execute the `composer require`

```
composer require jciel/pgraph @dev

```

or add in the require section `composer.json`

```
"require": {
    "jciel/pgraph": "@dev"
}
```

Quickstart examples
-------------------

[](#quickstart-examples)

Binary Tree
===========

[](#binary-tree)

### Working with scalar values and Binary Tree

[](#working-with-scalar-values-and-binary-tree)

That Tree trying always create a complete tree from the left to right

#### Instantiate and define search compare function

[](#instantiate-and-define-search-compare-function)

We first instantiate a BT,for the search we must define the 'search function', this allows the user to define what he is working with.
As we are working with scalar values the function is similar to this, this function should return true or false.
The $value variable is the value to be found.
The $currentVertex variable is the current vertex/node in the search process

```
