Building a Graph data structure in PHP
From the post:
Graphs are one of the most frequently used data structures,along with linked lists and trees. In a recent PHP project I needed to build a Graph structure to analyze some interlinked urls. The problem was of a simple nature, so rather than writing my own code, I went with the one available in the Pear repository.
The Pear Structures_Graph package allows creating and manipulating graph data structures. It allows building of either directed or undirected graphs, with data and metadata stored in nodes. The library provides functions for graph traversing as well as for characteristic extraction from the graph topology.
You won’t be processing sharded graph databases in PHP (hopefully) but you may have other graph applications for which PHP will be entirely appropriate.
And if nothing else, it is an easy way to experiment with graphs as a data structure.