Another Word For It Patrick Durusau on Topic Maps and Semantic Diversity

February 17, 2012

Building a Graph data structure in PHP

Filed under: Graphs,PHP — Patrick Durusau @ 5:09 pm

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.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress