# SPL Binary Tree, Graph

- Thread: https://externals.io/message/68173
- Original archive: https://news-web.php.net/php.internals/68173
- Started by bohdan007@gmail.com on 2013-07-18T22:20:21+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #68173 — bohdan007@gmail.com — 2013-07-18T22:20:21+00:00

URL: https://externals.io/message/68173#68173

Dear PHP Developers,


I would like to ask you what is your opinion about implementing Binary Tree
and Graph data structures in SPL in addition to existing ones? IMHO it
would be great because that will prevent from inventing a wheel all the
time, and prove that PHP is full featured language like C#, Java, ...


Best regards and THANK YOU for what YOU DO,
Bohdan

---

## #68174 — Levi Morrison — 2013-07-18T23:00:18+00:00

URL: https://externals.io/message/68173#68174 · In reply to: #68173

>
> I would like to ask you what is your opinion about implementing Binary Tree
> and Graph data structures in SPL in addition to existing ones? IMHO it
> would be great because that will prevent from inventing a wheel all the
> time, and prove that PHP is full featured language like C#, Java, ...
>

Convince me with use-cases; I don't think proving that we're as
"full-featured" as C# is helpful, healthy or necessary.

---

## #68175 — Stas Malyshev — 2013-07-18T23:09:05+00:00

URL: https://externals.io/message/68173#68175 · In reply to: #68173

Hi!

> I would like to ask you what is your opinion about implementing Binary Tree
> and Graph data structures in SPL in addition to existing ones? IMHO it

Sure, why not? But I'd suggest first proposing the API for the classes
in the form of the RFC (https://wiki.php.net/rfc) and explanation what
is their goals and what they would allow to do better than it is done
before, then collecting the feedback and proceeding from there to
implementation if the feedback proves that the community is supportive
of this.

> would be great because that will prevent from inventing a wheel all the
> time, and prove that PHP is full featured language like C#, Java, ...

I don't think after 18 years of history of being used by millions of
developers and being one of the most widely used open source software
projects we need to "prove" to anybody that PHP is a full featured
language, but improving PHP to serve the users better is always the
goal. So if you think you can help in making PHP better - great!
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

---

## #68189 — bohdan007@gmail.com — 2013-07-19T09:22:21+00:00

URL: https://externals.io/message/68173#68189 · In reply to: #68174

Hello Levi,


Your statement is fair enough.
Use cases I can think about are social, network, geographical, connected
flights graphs, work with hierarchical data like corporations structures,
products categories, indexing objects tree stored in memory/cache and PHP
web applications representing those relations and solving common problems
(has connection, shortest path, MST, recommendations in social graph,
search). PHP was born for web and should stay on cutting edge, serving
needs of web applications.

Maybe in a real world, because of PHP performance it probably will not be
so effective anyways, but for education purposes it would be great. In
general, reason for implementing Graph and Tree is the same as for already
existing data structures in SPL.


Best regards,
Bohdan


2013/7/19 Levi Morrison <morrison.levi@gmail.com>

> I would like to ask you what is your opinion about implementing Binary Tree
> > […]
>
> Convince me with use-cases; I don't think proving that we're as
> "full-featured" as C# is helpful, healthy or necessary.

---

## #68204 — Levi Morrison — 2013-07-19T14:07:43+00:00

URL: https://externals.io/message/68173#68204 · In reply to: #68189

>  I would like to ask you what is your opinion about implementing Binary
> > […]
>
>

Use cases I can think about are social, network, geographical, connected
> flights graphs, work with hierarchical data like corporations structures,
> products categories, indexing objects tree stored in memory/cache and PHP
> web applications representing those relations and solving common problems
> (has connection, shortest path, MST, recommendations in social graph,
> search)
>

If you can extract a useful, common API for all of those tasks then I would
definitely support implementing Graphs in the SPL.

Maybe in a real world, because of PHP performance it probably will not be
> so effective anyways


If we end up putting graphs in the SPL then performance would be a big
reason to do so; it would be written in C.

---

## #68405 — bohdan007@gmail.com — 2013-08-07T20:35:09+00:00

URL: https://externals.io/message/68173#68405 · In reply to: #68204

Hello Levi and core devs,


I think it's better not to invent a wheel but rather extract best practices
from time proved projects such as Gremlin,
http://erldocs.com/R15B/stdlib/digraph.html looks not bad as well.
Definitely there are a lot of bright minds among PHP core developers and
PHP community and they can vote for/define Graph API for PHP if they would
have such a willing. BTW i was talking about Trees too and Binary in
particular.
If you think i just bother you and waste your time, please ignore me and
continue to do great job improving PHP.


Best regards,
Bohdan


2013/7/19 Levi Morrison <morrison.levi@gmail.com>

>
>  I would like to ask you what is your opinion about implementing Binary
> > […]
>
> Use cases I can think about are social, network, geographical, connected
> > […]
>
> If you can extract a useful, common API for all of those tasks then I
> would definitely support implementing Graphs in the SPL.
>
> Maybe in a real world, because of PHP performance it probably will not be
> > […]
>
>
> If we end up putting graphs in the SPL then performance would be a big
> reason to do so; it would be written in C.
