Бортовой журнал Ктулху

Posts Tagged 'graph' [страница 1]

Graphs in PHP in 5 Minutes (BFS)

A graph is a set of connected points — just like people in a social network, cities on a map, or links between web pages.

Sometimes we need to find the shortest connection — for example, the fewest hops between two people. That’s where Breadth-First Search (BFS) helps.

It explores all neighbors first, then moves level by level — guaranteeing the shortest path in an unweighted network.

Articles tagged

Read more...