Download the PHP package stratadox/graphp-finder without Composer
On this page you can find all versions of the php package stratadox/graphp-finder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package graphp-finder
GraphpFinder
An adapter to make Graphp compatible with Pathfinder.
Installation
Install with composer require stratadox/graphp-finder
Features
This Graphp adapter aims to honour the Graphp philosophy in terms of supporting both directed and undirected graphs, as well as both single- and multi graphs.
The above features roughly correspond to what Pathfinder calls a Network. In addition to networks, Pathfinder can operate on what it refers to as Environments: graphs with Cartesian coordinates attached to their vertices.
An advantage of using an environment over a network is that search algorithms can be optimised through the use of heuristics, a technique used by Pathfinder's A* implementation.
This adapter can be used to transform a Graphp graph into either an environment
or a network. In order to achieve compatibility, the environment adapter makes
use of Graphp's concept of attributes
.
Attributes in Graphp are key-value pairs; the environment adapter requires at
least the keys x
and y
to be present, also using z
when available.
Examples
Environment without GraphpFinder
The "normal" way to use the Pathfinder module looks somewhat like this:
Network with GraphpFinder
In case you're using a Graphp graph, you can use this adapter to make them compatible:
Environment with GraphpFinder
You can use attributes to define the coordinates, improving the speed of finding the shortest path(s) through the graph:
These latter examples look like it's more code, but that's only because creating a Graphp graph is somewhat more verbose compared to the various graph builders that come with the Pathfinder module.
When you've already got a Graphp graph, using AdaptedEnvironment::from($graph)
is a lot shorter, faster and less cumbersome than creating and maintaining an
extra copy of your entire graph just for the pathfinder.
3D environment with GraphpFinder
Three dimensional coordinates are equally supported: