Skip to content

Commit ee2470d

Browse files
authored
Merge pull request #41 from clue-labs/deps
Update to graphp/graph
2 parents fb5beb5 + ff96a92 commit ee2470d

File tree

80 files changed

+419
-421
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+419
-421
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
],
1313
"require": {
1414
"php": ">=5.3",
15-
"clue/graph": "~0.9.0|~0.8.0"
15+
"graphp/graph": "dev-master#fb198e4 as 1.0.0"
1616
},
1717
"require-dev": {
1818
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35"

src/BaseDual.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Graphp\Algorithms;
44

5-
use Fhaculty\Graph\Graph;
6-
use Fhaculty\Graph\Set\DualAggregate;
7-
use Fhaculty\Graph\Walk;
5+
use Graphp\Graph\Graph;
6+
use Graphp\Graph\Set\DualAggregate;
7+
use Graphp\Graph\Walk;
88

99
/**
1010
* Abstract base class for algorithms that operate on a given Set instance

src/BaseGraph.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Graphp\Algorithms;
44

5-
use Fhaculty\Graph\Graph;
5+
use Graphp\Graph\Graph;
66

77
/**
88
* Abstract base class for algorithms that operate on a given Graph instance

src/BaseVertex.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Graphp\Algorithms;
44

5-
use Fhaculty\Graph\Vertex;
5+
use Graphp\Graph\Vertex;
66

77
/**
88
* Abstract base class for algorithms that operate on a given Vertex instance

src/Bipartit.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Graphp\Algorithms;
44

5-
use Fhaculty\Graph\Exception\UnexpectedValueException;
6-
use Fhaculty\Graph\Graph;
5+
use Graphp\Graph\Exception\UnexpectedValueException;
6+
use Graphp\Graph\Graph;
77

88
class Bipartit extends BaseGraph
99
{

src/ConnectedComponents.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Graphp\Algorithms;
44

5-
use Fhaculty\Graph\Exception\InvalidArgumentException;
6-
use Fhaculty\Graph\Exception\UnderflowException;
7-
use Fhaculty\Graph\Graph;
8-
use Fhaculty\Graph\Vertex;
95
use Graphp\Algorithms\Search\BreadthFirst as SearchBreadthFirst;
6+
use Graphp\Graph\Exception\InvalidArgumentException;
7+
use Graphp\Graph\Exception\UnderflowException;
8+
use Graphp\Graph\Graph;
9+
use Graphp\Graph\Vertex;
1010

1111
/**
1212
* Algorithm for working with connected components

src/Degree.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Graphp\Algorithms;
44

5-
use Fhaculty\Graph\Exception\UnderflowException;
6-
use Fhaculty\Graph\Exception\UnexpectedValueException;
7-
use Fhaculty\Graph\Vertex;
5+
use Graphp\Graph\Exception\UnderflowException;
6+
use Graphp\Graph\Exception\UnexpectedValueException;
7+
use Graphp\Graph\Vertex;
88

99
/**
1010
* Basic algorithms for working with the degrees of Graphs.

src/DetectNegativeCycle.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
namespace Graphp\Algorithms;
44

5-
use Fhaculty\Graph\Exception\NegativeCycleException;
6-
use Fhaculty\Graph\Exception\UnderflowException;
7-
use Fhaculty\Graph\Graph;
8-
use Fhaculty\Graph\Walk;
95
use Graphp\Algorithms\ShortestPath\MooreBellmanFord as SpMooreBellmanFord;
6+
use Graphp\Graph\Exception\NegativeCycleException;
7+
use Graphp\Graph\Exception\UnderflowException;
8+
use Graphp\Graph\Graph;
9+
use Graphp\Graph\Walk;
1010

1111
class DetectNegativeCycle extends BaseGraph
1212
{

src/Directed.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Graphp\Algorithms;
44

5-
use Fhaculty\Graph\Edge\Directed as EdgeDirected;
6-
use Fhaculty\Graph\Edge\Undirected as EdgeUndirected;
5+
use Graphp\Graph\EdgeDirected;
6+
use Graphp\Graph\EdgeUndirected;
77

88
/**
99
* Basic algorithms for working with the undirected or directed Graphs (digraphs) / Walks.

src/Flow.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Graphp\Algorithms;
44

5-
use Fhaculty\Graph\Edge\Directed as EdgeDirected;
6-
use Fhaculty\Graph\Exception\UnexpectedValueException;
7-
use Fhaculty\Graph\Vertex;
5+
use Graphp\Graph\EdgeDirected;
6+
use Graphp\Graph\Exception\UnexpectedValueException;
7+
use Graphp\Graph\Vertex;
88

99
/**
1010
* Basic algorithms for working with flow graphs

src/Groups.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
namespace Graphp\Algorithms;
44

5-
use Fhaculty\Graph\Set\Vertices;
6-
use Fhaculty\Graph\Vertex;
5+
use Graphp\Graph\Set\Vertices;
6+
use Graphp\Graph\Vertex;
77

88
class Groups extends BaseGraph
99
{

src/Loop.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace Graphp\Algorithms;
44

5-
use Fhaculty\Graph\Vertex;
5+
use Graphp\Graph\Vertex;
66

77
/**
88
* Basic algorithms for working with loop edges

src/MaxFlow/EdmondsKarp.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
namespace Graphp\Algorithms\MaxFlow;
44

5-
use Fhaculty\Graph\Edge\Directed as EdgeDirected;
6-
use Fhaculty\Graph\Exception\InvalidArgumentException;
7-
use Fhaculty\Graph\Exception\OutOfBoundsException;
8-
use Fhaculty\Graph\Exception\UnderflowException;
9-
use Fhaculty\Graph\Exception\UnexpectedValueException;
10-
use Fhaculty\Graph\Graph;
11-
use Fhaculty\Graph\Set\Edges;
12-
use Fhaculty\Graph\Vertex;
135
use Graphp\Algorithms\Base;
146
use Graphp\Algorithms\ResidualGraph;
157
use Graphp\Algorithms\ShortestPath\BreadthFirst;
8+
use Graphp\Graph\EdgeDirected;
9+
use Graphp\Graph\Exception\InvalidArgumentException;
10+
use Graphp\Graph\Exception\OutOfBoundsException;
11+
use Graphp\Graph\Exception\UnderflowException;
12+
use Graphp\Graph\Exception\UnexpectedValueException;
13+
use Graphp\Graph\Graph;
14+
use Graphp\Graph\Set\Edges;
15+
use Graphp\Graph\Vertex;
1616

1717
class EdmondsKarp extends Base
1818
{

src/MaximumMatching/Base.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Graphp\Algorithms\MaximumMatching;
44

5-
use Fhaculty\Graph\Exception\UnexpectedValueException;
6-
use Fhaculty\Graph\Graph;
7-
use Fhaculty\Graph\Set\Edges;
85
use Graphp\Algorithms\BaseGraph;
6+
use Graphp\Graph\Exception\UnexpectedValueException;
7+
use Graphp\Graph\Graph;
8+
use Graphp\Graph\Set\Edges;
99

1010
abstract class Base extends BaseGraph
1111
{

src/MaximumMatching/Flow.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace Graphp\Algorithms\MaximumMatching;
44

5-
use Fhaculty\Graph\Exception\UnexpectedValueException;
6-
use Fhaculty\Graph\Set\Edges;
7-
use Fhaculty\Graph\Vertex;
85
use Graphp\Algorithms\Directed;
96
use Graphp\Algorithms\Groups;
107
use Graphp\Algorithms\MaxFlow\EdmondsKarp as MaxFlowEdmondsKarp;
8+
use Graphp\Graph\Exception\UnexpectedValueException;
9+
use Graphp\Graph\Set\Edges;
10+
use Graphp\Graph\Vertex;
1111

1212
class Flow extends Base
1313
{
@@ -42,16 +42,16 @@ public function getEdges()
4242

4343
if ($group === $groupA) {
4444
// group A: source
45-
$superSource->createEdgeTo($vertex)->setCapacity(1)->setFlow(0);
45+
$graphFlow->createEdgeDirected($superSource, $vertex)->setCapacity(1)->setFlow(0);
4646

4747
// temporarily create edges from A->B for flow graph
4848
$originalVertex = $this->graph->getVertex($vertex->getId());
4949
foreach ($originalVertex->getVerticesEdgeTo() as $vertexTarget) {
50-
$vertex->createEdgeTo($graphFlow->getVertex($vertexTarget->getId()))->setCapacity(1)->setFlow(0);
50+
$graphFlow->createEdgeDirected($vertex, $graphFlow->getVertex($vertexTarget->getId()))->setCapacity(1)->setFlow(0);
5151
}
5252
} else {
5353
// group B: sink
54-
$vertex->createEdgeTo($superSink)->setCapacity(1)->setFlow(0);
54+
$graphFlow->createEdgeDirected($vertex, $superSink)->setCapacity(1)->setFlow(0);
5555
}
5656
}
5757

src/MinimumCostFlow/Base.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
use Graphp\Algorithms\BaseGraph;
66
use Graphp\Algorithms\Weight as AlgorithmWeight;
77
use Graphp\Algorithms\Flow as AlgorithmFlow;
8-
use Fhaculty\Graph\Exception\UnderflowException;
9-
use Fhaculty\Graph\Exception\UnexpectedValueException;
10-
use Fhaculty\Graph\Graph;
11-
use Fhaculty\Graph\Set\Edges;
8+
use Graphp\Graph\Exception\UnderflowException;
9+
use Graphp\Graph\Exception\UnexpectedValueException;
10+
use Graphp\Graph\Graph;
11+
use Graphp\Graph\Set\Edges;
1212

1313
abstract class Base extends BaseGraph
1414
{

src/MinimumCostFlow/CycleCanceling.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
namespace Graphp\Algorithms\MinimumCostFlow;
44

5-
use Fhaculty\Graph\Exception\UnderflowException;
6-
use Fhaculty\Graph\Exception\UnexpectedValueException;
7-
use Fhaculty\Graph\Set\Edges;
85
use Graphp\Algorithms\DetectNegativeCycle;
96
use Graphp\Algorithms\MaxFlow\EdmondsKarp as MaxFlowEdmondsKarp;
107
use Graphp\Algorithms\ResidualGraph;
8+
use Graphp\Graph\Exception\UnderflowException;
9+
use Graphp\Graph\Exception\UnexpectedValueException;
10+
use Graphp\Graph\Set\Edges;
1111

1212
class CycleCanceling extends Base
1313
{
@@ -29,12 +29,12 @@ public function createGraph()
2929

3030
if ($balance > 0) {
3131
// positive balance => source capacity
32-
$superSource->createEdgeTo($vertex)->setCapacity($balance);
32+
$resultGraph->createEdgeDirected($superSource, $vertex)->setCapacity($balance);
3333

3434
$sumBalance += $balance;
3535
} elseif ($balance < 0) {
3636
// negative balance => sink capacity (positive)
37-
$vertex->createEdgeTo($superSink)->setCapacity(-$balance);
37+
$resultGraph->createEdgeDirected($vertex, $superSink)->setCapacity(-$balance);
3838
}
3939
}
4040

src/MinimumCostFlow/SuccessiveShortestPath.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22

33
namespace Graphp\Algorithms\MinimumCostFlow;
44

5-
use Fhaculty\Graph\Edge\Directed as EdgeDirected;
6-
use Fhaculty\Graph\Exception\UnderflowException;
7-
use Fhaculty\Graph\Exception\UnexpectedValueException;
8-
use Fhaculty\Graph\Graph;
9-
use Fhaculty\Graph\Set\Edges;
10-
use Fhaculty\Graph\Vertex;
115
use Graphp\Algorithms\ResidualGraph;
126
use Graphp\Algorithms\ShortestPath\MooreBellmanFord as SpMooreBellmanFord;
137
use Graphp\Algorithms\Search\BreadthFirst as SearchBreadthFirst;
8+
use Graphp\Graph\EdgeDirected;
9+
use Graphp\Graph\Exception\UnderflowException;
10+
use Graphp\Graph\Exception\UnexpectedValueException;
11+
use Graphp\Graph\Graph;
12+
use Graphp\Graph\Set\Edges;
13+
use Graphp\Graph\Vertex;
1414

1515
class SuccessiveShortestPath extends Base
1616
{

src/MinimumSpanningTree/Base.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Graphp\Algorithms\MinimumSpanningTree;
44

5-
use Fhaculty\Graph\Edge\Base as Edge;
6-
use Fhaculty\Graph\Graph;
7-
use Fhaculty\Graph\Set\Edges;
85
use Graphp\Algorithms\Base as AlgorithmBase;
6+
use Graphp\Graph\Edge;
7+
use Graphp\Graph\Graph;
8+
use Graphp\Graph\Set\Edges;
99
use SplPriorityQueue;
1010

1111
/**

src/MinimumSpanningTree/Kruskal.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Graphp\Algorithms\MinimumSpanningTree;
44

5-
use Fhaculty\Graph\Edge\Base as Edge;
6-
use Fhaculty\Graph\Exception\UnexpectedValueException;
7-
use Fhaculty\Graph\Graph;
8-
use Fhaculty\Graph\Set\Edges;
5+
use Graphp\Graph\Edge;
6+
use Graphp\Graph\Exception\UnexpectedValueException;
7+
use Graphp\Graph\Graph;
8+
use Graphp\Graph\Set\Edges;
99
use SplPriorityQueue;
1010

1111
class Kruskal extends Base

src/MinimumSpanningTree/Prim.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Graphp\Algorithms\MinimumSpanningTree;
44

5-
use Fhaculty\Graph\Edge\Base as Edge;
6-
use Fhaculty\Graph\Exception\UnexpectedValueException;
7-
use Fhaculty\Graph\Set\Edges;
8-
use Fhaculty\Graph\Vertex;
5+
use Graphp\Graph\Edge;
6+
use Graphp\Graph\Exception\UnexpectedValueException;
7+
use Graphp\Graph\Set\Edges;
8+
use Graphp\Graph\Vertex;
99
use SplPriorityQueue;
1010

1111
class Prim extends Base

src/Parallel.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
namespace Graphp\Algorithms;
44

5-
use Fhaculty\Graph\Edge\Base as Edge;
6-
use Fhaculty\Graph\Edge\Directed as DirectedEdge;
7-
use Fhaculty\Graph\Set\Edges;
8-
use LogicException;
5+
use Graphp\Graph\Edge;
6+
use Graphp\Graph\EdgeDirected as EdgeDirected;
7+
use Graphp\Graph\Set\Edges;
98

109
/**
1110
* Basic algorithms for working with parallel edges
@@ -52,11 +51,10 @@ public function hasEdgeParallelEdge(Edge $edge)
5251
*
5352
* @param Edge $edge
5453
* @return Edges
55-
* @throws LogicException
5654
*/
5755
public function getEdgesParallelEdge(Edge $edge)
5856
{
59-
if ($edge instanceof DirectedEdge) {
57+
if ($edge instanceof EdgeDirected) {
6058
// get all edges between this edge's endpoints
6159
$edges = $edge->getVertexStart()->getEdgesTo($edge->getVertexEnd())->getVector();
6260
} else {

src/Property/WalkProperty.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace Graphp\Algorithms\Property;
44

5-
use Fhaculty\Graph\Walk;
65
use Graphp\Algorithms\Base as BaseAlgorithm;
76
use Graphp\Algorithms\Loop as AlgorithmLoop;
7+
use Graphp\Graph\Walk;
88

99
/**
1010
* Simple algorithms for working with Walk properties

src/ResidualGraph.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Graphp\Algorithms;
44

5-
use Fhaculty\Graph\Edge\Base as Edge;
6-
use Fhaculty\Graph\Edge\Directed as EdgeDirected;
7-
use Fhaculty\Graph\Exception\UnexpectedValueException;
8-
use Fhaculty\Graph\Graph;
5+
use Graphp\Graph\Edge;
6+
use Graphp\Graph\EdgeDirected;
7+
use Graphp\Graph\Exception\UnexpectedValueException;
8+
use Graphp\Graph\Graph;
99

1010
class ResidualGraph extends BaseGraph
1111
{

src/Search/Base.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Graphp\Algorithms\Search;
44

5-
use Fhaculty\Graph\Exception\InvalidArgumentException;
6-
use Fhaculty\Graph\Set\Vertices;
7-
use Fhaculty\Graph\Vertex;
85
use Graphp\Algorithms\BaseVertex;
6+
use Graphp\Graph\Exception\InvalidArgumentException;
7+
use Graphp\Graph\Set\Vertices;
8+
use Graphp\Graph\Vertex;
99

1010
abstract class Base extends BaseVertex
1111
{

0 commit comments

Comments
 (0)