n one of my previous articles I introduced you to the tree data structure. Now I'd like to explore a related structure - the graph. Graphs have a number of real-world applications, such as network optimization, traffic routing, and social network analysis. Google's PageRank, Facebook's Graph Search, and Amazon's and NetFlix's recommendations are some examples of graph-driven applications. In this article I'll explore two common problems in which graphs are used - the Least Number of Hops and Shortest-Path problems.

He explains graphs mathematically, describing them as a set of relationships between nodes and the "lines" that connect them. There's other things involved including directions and weight, but there's not too much detail on those. Instead he gets right into the problems. First is the "Least Number of Hops" and second the "Find the Shortest Path", each with some explanation and sample code of their implementation.

Link: http://phpmaster.com/data-structures-4]]>