File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
use Fhaculty \Graph \Walk ;
6
6
use Fhaculty \Graph \Algorithm \Base as BaseAlgorithm ;
7
+ use Fhaculty \Graph \Algorithm \Loop as AlgorithmLoop ;
7
8
8
9
/**
9
10
* Simple algorithms for working with Walk properties
@@ -57,16 +58,31 @@ public function hasCycle()
57
58
}
58
59
59
60
/**
60
- * checks whether this walk is a loop (single edge connecting vertex A with vertex A again)
61
+ * checks whether this walk IS a loop (single edge connecting vertex A with vertex A again)
61
62
*
62
63
* @return boolean
63
64
* @uses self::isCycle()
65
+ * @see self::hasLoop()
64
66
*/
65
67
public function isLoop ()
66
68
{
67
69
return ($ this ->walk ->getNumberOfEdges () === 1 && $ this ->isCycle ());
68
70
}
69
71
72
+ /**
73
+ * checks whether this walk HAS a look (single edge connecting vertex A with vertex A again)
74
+ *
75
+ * @return boolean
76
+ * @uses AlgorithmLoop::hasLoop()
77
+ * @see self::isLoop()
78
+ */
79
+ public function hasLoop ()
80
+ {
81
+ $ alg = new AlgorithmLoop ($ this ->walk );
82
+
83
+ return $ alg ->hasLoop ();
84
+ }
85
+
70
86
/**
71
87
* checks whether this walk is a digon (a pair of parallel edges in a multigraph or a pair of antiparallel edges in a digraph)
72
88
*
You can’t perform that action at this time.
0 commit comments