File tree Expand file tree Collapse file tree 3 files changed +91
-0
lines changed Expand file tree Collapse file tree 3 files changed +91
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Fhaculty \Graph \Algorithm ;
4
+
5
+ use Fhaculty \Graph \Algorithm \Base ;
6
+ use Fhaculty \Graph \Graph ;
7
+
8
+ /**
9
+ * Abstract base class for algorithms that operate on a given Graph instance
10
+ */
11
+ abstract class BaseGraph extends Base
12
+ {
13
+ /**
14
+ * Graph to operate on
15
+ *
16
+ * @var Graph
17
+ */
18
+ protected $ graph ;
19
+
20
+ /**
21
+ * instantiate new algorithm
22
+ *
23
+ * @param Graph $graph Graph to operate on
24
+ */
25
+ public function __construct (Graph $ graph )
26
+ {
27
+ $ this ->graph = $ graph ;
28
+ }
29
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Fhaculty \Graph \Algorithm ;
4
+
5
+ use Fhaculty \Graph \Algorithm \Base ;
6
+ use Fhaculty \Graph \Set ;
7
+ use Fhaculty \Graph \Graph ;
8
+ use Fhaculty \Graph \Walk ;
9
+
10
+ /**
11
+ * Abstract base class for algorithms that operate on a given Set instance
12
+ *
13
+ * @see Set
14
+ */
15
+ abstract class BaseSet extends Base
16
+ {
17
+ /**
18
+ * Set to operate on
19
+ *
20
+ * @var Set
21
+ */
22
+ protected $ set ;
23
+
24
+ /**
25
+ * instantiate new algorithm
26
+ *
27
+ * @param Graph|Walk|Set $graphOrWalk either the Graph or Walk to operate on (or the common base class Set)
28
+ */
29
+ public function __construct (Set $ graphOrWalk )
30
+ {
31
+ $ this ->set = $ graphOrWalk ;
32
+ }
33
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Fhaculty \Graph \Algorithm ;
4
+
5
+ use Fhaculty \Graph \Algorithm \Base ;
6
+ use Fhaculty \Graph \Vertex ;
7
+
8
+ /**
9
+ * Abstract base class for algorithms that operate on a given Vertex instance
10
+ */
11
+ abstract class BaseVertex extends Base
12
+ {
13
+ /**
14
+ * Vertex to operate on
15
+ *
16
+ * @var Vertex
17
+ */
18
+ protected $ vertex ;
19
+
20
+ /**
21
+ * instantiate new algorithm
22
+ *
23
+ * @param Vertex $vertex Vertex to operate on
24
+ */
25
+ public function __construct (Vertex $ vertex )
26
+ {
27
+ $ this ->vertex = $ vertex ;
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments