22
33namespace Graphp \Algorithms ;
44
5- use Graphp \Algorithms \BaseGraph ;
6- use Fhaculty \Graph \Graph ;
7- use Fhaculty \Graph \Vertex ;
5+ use Fhaculty \Graph \Exception \UnderflowException ;
86use Fhaculty \Graph \Exception \UnexpectedValueException ;
9- use Fhaculty \Graph \Set \ Vertices ;
7+ use Fhaculty \Graph \Vertex ;
108
119/**
1210 * Basic algorithms for working with the degrees of Graphs.
@@ -34,7 +32,7 @@ public function getDegree()
3432 $ degree = $ this ->getDegreeVertex ($ this ->graph ->getVertices ()->getVertexFirst ());
3533
3634 foreach ($ this ->graph ->getVertices () as $ vertex ) {
37- /** @var $vertex Vertex */
35+ assert ( $ vertex instanceof Vertex);
3836 $ i = $ this ->getDegreeVertex ($ vertex );
3937
4038 if ($ i !== $ degree ) {
@@ -49,7 +47,7 @@ public function getDegree()
4947 * get minimum degree of vertices
5048 *
5149 * @return int
52- * @throws Exception if graph is empty or directed
50+ * @throws UnderflowException if graph is empty
5351 * @uses Vertices::getVertexOrder()
5452 * @uses self::getDegreeVertex()
5553 */
@@ -62,7 +60,7 @@ public function getDegreeMin()
6260 * get maximum degree of vertices
6361 *
6462 * @return int
65- * @throws Exception if graph is empty or directed
63+ * @throws UnderflowException if graph is empty
6664 * @uses Vertices::getVertexOrder()
6765 * @uses self::getDegreeVertex()
6866 */
@@ -74,7 +72,7 @@ public function getDegreeMax()
7472 /**
7573 * checks whether this graph is regular, i.e. each vertex has the same indegree/outdegree
7674 *
77- * @return boolean
75+ * @return bool
7876 * @uses self::getDegree()
7977 */
8078 public function isRegular ()
@@ -95,7 +93,7 @@ public function isRegular()
9593 /**
9694 * checks whether the indegree of every vertex equals its outdegree
9795 *
98- * @return boolean
96+ * @return bool
9997 * @uses self::getDegreeInVertex()
10098 * @uses self::getDegreeOutVertex()
10199 */
@@ -114,7 +112,7 @@ public function isBalanced()
114112 * checks whether this vertex is a source, i.e. its indegree is zero
115113 *
116114 * @param Vertex $vertex
117- * @return boolean
115+ * @return bool
118116 * @uses Edge::hasVertexTarget()
119117 * @see self::getDegreeInVertex()
120118 */
@@ -134,7 +132,7 @@ public function isVertexSource(Vertex $vertex)
134132 * checks whether this vertex is a sink, i.e. its outdegree is zero
135133 *
136134 * @param Vertex $vertex
137- * @return boolean
135+ * @return bool
138136 * @uses Edge::hasVertexStart()
139137 * @see self::getDegreeOutVertex()
140138 */
@@ -171,7 +169,7 @@ public function getDegreeVertex(Vertex $vertex)
171169 * check whether this vertex is isolated (i.e. has no edges attached)
172170 *
173171 * @param Vertex $vertex
174- * @return boolean
172+ * @return bool
175173 */
176174 public function isVertexIsolated (Vertex $ vertex )
177175 {
0 commit comments