graphp / graph

GraPHP is the mathematical graph/network library written in PHP.
MIT License
694 stars 74 forks source link

Rename Edge classes to Edge, EdgeUndirected and EdgeDirected #178

Closed clue closed 5 years ago

clue commented 5 years ago

The new API is now much more consistent and explicit:

// old
assert($v1->createEdge($v2) instanceof Graphp\Graph\Edge\Undirected);
assert($v1->createEdgeTo($v2) instanceof Graphp\Graph\Edge\Directed);
assert($edge instanceof Graphp\Graph\Edge\Base);

// new
assert($graph->createEdgeUndirected($v1, $v2) instanceof Graphp\Graph\EdgeUndirected);
assert($graph->createEdgeDirected($v1, $v2) instanceof Graphp\Graph\EdgeDirected);
assert($edge instanceof Graphp\Graph\Edge);

Builds on top of #175 and #166