├── .codeclimate.yml
├── .csslintrc
├── .eslintignore
├── .eslintrc
├── .gitignore
├── .travis.yml
├── Dockerfile
├── LICENSE
├── README.md
├── SampleApp_RoadPlanner
└── src
│ ├── data
│ ├── X.png
│ ├── germany.png
│ └── roads.json
│ └── index.php
├── composer.json
├── composer.lock
├── doc
├── .htaccess
├── classes
│ ├── GraphDS.Algo.BFS.html
│ ├── GraphDS.Algo.DFS.html
│ ├── GraphDS.Algo.Dijkstra.html
│ ├── GraphDS.Algo.DijkstraMulti.html
│ ├── GraphDS.Algo.FloydWarshall.html
│ ├── GraphDS.Edge.DirectedEdge.html
│ ├── GraphDS.Edge.Edge.html
│ ├── GraphDS.Edge.UndirectedEdge.html
│ ├── GraphDS.Graph.DirectedGraph.html
│ ├── GraphDS.Graph.Graph.html
│ ├── GraphDS.Graph.UndirectedGraph.html
│ ├── GraphDS.Persistence.ExportGraph.html
│ ├── GraphDS.Persistence.ImportGraph.html
│ ├── GraphDS.Vertex.DirectedVertex.html
│ ├── GraphDS.Vertex.UndirectedVertex.html
│ └── GraphDS.Vertex.Vertex.html
├── css
│ ├── bootstrap-combined.no-icons.min.css
│ ├── font-awesome.min.css
│ ├── jquery.iviewer.css
│ ├── phpdocumentor-clean-icons
│ │ ├── Read Me.txt
│ │ ├── fonts
│ │ │ ├── phpdocumentor-clean-icons.dev.svg
│ │ │ ├── phpdocumentor-clean-icons.eot
│ │ │ ├── phpdocumentor-clean-icons.svg
│ │ │ ├── phpdocumentor-clean-icons.ttf
│ │ │ └── phpdocumentor-clean-icons.woff
│ │ ├── lte-ie7.js
│ │ └── style.css
│ ├── prism.css
│ └── template.css
├── files
│ ├── Algo.BFS.html
│ ├── Algo.DFS.html
│ ├── Algo.Dijkstra.html
│ ├── Algo.DijkstraMulti.html
│ ├── Algo.FloydWarshall.html
│ ├── Algo
│ │ ├── BFS.php.txt
│ │ ├── DFS.php.txt
│ │ ├── Dijkstra.php.txt
│ │ ├── DijkstraMulti.php.txt
│ │ └── FloydWarshall.php.txt
│ ├── Edge.DirectedEdge.html
│ ├── Edge.Edge.html
│ ├── Edge.UndirectedEdge.html
│ ├── Edge
│ │ ├── DirectedEdge.php.txt
│ │ ├── Edge.php.txt
│ │ └── UndirectedEdge.php.txt
│ ├── Graph.DirectedGraph.html
│ ├── Graph.Graph.html
│ ├── Graph.UndirectedGraph.html
│ ├── Graph
│ │ ├── DirectedGraph.php.txt
│ │ ├── Graph.php.txt
│ │ └── UndirectedGraph.php.txt
│ ├── Persistence.ExportGraph.html
│ ├── Persistence.ImportGraph.html
│ ├── Persistence
│ │ ├── ExportGraph.php.txt
│ │ └── ImportGraph.php.txt
│ ├── Vertex.DirectedVertex.html
│ ├── Vertex.UndirectedVertex.html
│ ├── Vertex.Vertex.html
│ └── Vertex
│ │ ├── DirectedVertex.php.txt
│ │ ├── UndirectedVertex.php.txt
│ │ └── Vertex.php.txt
├── font
│ ├── FontAwesome.otf
│ ├── fontawesome-webfont.eot
│ ├── fontawesome-webfont.svg
│ ├── fontawesome-webfont.ttf
│ └── fontawesome-webfont.woff
├── graphs
│ └── class.html
├── images
│ ├── apple-touch-icon-114x114.png
│ ├── apple-touch-icon-72x72.png
│ ├── apple-touch-icon.png
│ ├── custom-icons.svg
│ ├── favicon.ico
│ ├── hierarchy-item.png
│ ├── icon-class-13x13.png
│ ├── icon-class.svg
│ ├── icon-interface-13x13.png
│ ├── icon-interface.svg
│ ├── icon-trait-13x13.png
│ ├── icon-trait.svg
│ └── iviewer
│ │ ├── grab.cur
│ │ ├── hand.cur
│ │ ├── iviewer.rotate_left.png
│ │ ├── iviewer.rotate_right.png
│ │ ├── iviewer.zoom_fit.png
│ │ ├── iviewer.zoom_in.png
│ │ ├── iviewer.zoom_out.png
│ │ └── iviewer.zoom_zero.png
├── index.html
├── js
│ ├── bootstrap.min.js
│ ├── html5.js
│ ├── jquery-1.11.0.min.js
│ ├── jquery.dotdotdot-1.5.9.js
│ ├── jquery.dotdotdot-1.5.9.min.js
│ ├── jquery.iviewer.js
│ ├── jquery.iviewer.min.js
│ ├── jquery.mousewheel.js
│ ├── jquery.smooth-scroll.js
│ ├── prism.min.js
│ └── ui
│ │ └── 1.10.4
│ │ └── jquery-ui.min.js
├── namespaces
│ ├── GraphDS.Algo.html
│ ├── GraphDS.Edge.html
│ ├── GraphDS.Graph.html
│ ├── GraphDS.Persistence.html
│ ├── GraphDS.Vertex.html
│ ├── GraphDS.html
│ └── default.html
├── phpdoc-cache-27
│ └── phpdoc-cache-file_d580c5cf141248ea36ddb71c897e2ea2.dat
├── phpdoc-cache-2e
│ └── phpdoc-cache-settings.dat
├── phpdoc-cache-55
│ └── phpdoc-cache-file_768478c531742d2f7b82584b600ec1e4.dat
├── phpdoc-cache-62
│ └── phpdoc-cache-file_d79fa81476025ceb69ab7391e56c543f.dat
├── phpdoc-cache-63
│ └── phpdoc-cache-file_ca98b54132bdaa7b1c0e24f4c25b7010.dat
├── phpdoc-cache-66
│ └── phpdoc-cache-file_13c172de4f11f8d8489e07126aa159d6.dat
├── phpdoc-cache-6c
│ └── phpdoc-cache-file_141beec229fc1c98d4c0fde0b361dbd5.dat
├── phpdoc-cache-77
│ └── phpdoc-cache-file_208a4703bb61d2ab7bd73a3205824e99.dat
├── phpdoc-cache-80
│ └── phpdoc-cache-file_8277e801acc317dc028b213f4986cf93.dat
├── phpdoc-cache-a3
│ └── phpdoc-cache-file_40f3db65d58a777c567b6c1a9b30878b.dat
├── phpdoc-cache-ab
│ └── phpdoc-cache-file_560151d14511e08d19af110deb82b0f5.dat
├── phpdoc-cache-b3
│ └── phpdoc-cache-file_acfdc7ddaf7670491e36bc9514fff3b0.dat
├── phpdoc-cache-c0
│ └── phpdoc-cache-file_401c95ca425ba0e1468e9c1d9fd054c9.dat
├── phpdoc-cache-cb
│ └── phpdoc-cache-file_ef179398984ad7740f054fab39bee0d2.dat
├── phpdoc-cache-d3
│ └── phpdoc-cache-file_546caeef9ab4d3a897a0cc8bd72d02c1.dat
├── phpdoc-cache-e9
│ └── phpdoc-cache-file_5b1ace65dbc34cc1ff0917c8f0a07d47.dat
├── phpdoc-cache-ea
│ └── phpdoc-cache-file_9676b1c9afe4332302de84fc726f60cc.dat
└── reports
│ ├── deprecated.html
│ ├── errors.html
│ └── markers.html
├── graphDirected.graphml
├── graphUndirected.graphml
├── phpunit.xml
├── src
├── Algo
│ ├── BFS.php
│ ├── DFS.php
│ ├── Dijkstra.php
│ ├── DijkstraMulti.php
│ ├── FloydWarshall.php
│ └── Yen.php
├── Edge
│ ├── DirectedEdge.php
│ ├── Edge.php
│ └── UndirectedEdge.php
├── Graph
│ ├── DirectedGraph.php
│ ├── Graph.php
│ └── UndirectedGraph.php
├── Persistence
│ ├── ExportGraph.php
│ └── ImportGraph.php
└── Vertex
│ ├── DirectedVertex.php
│ ├── UndirectedVertex.php
│ └── Vertex.php
└── tests
├── Algo
├── BFSTest.php
├── DFSTest.php
├── DijkstraMultiTest.php
├── DijkstraTest.php
├── FloydWarshallTest.php
└── YenTest.php
├── Graph
├── DirectedGraphTest.php
└── UndirectedGraphTest.php
├── Persistence
└── ImportExportGraphTest.php
└── Traits
└── GraphInteractionTrait.php
/.codeclimate.yml:
--------------------------------------------------------------------------------
1 | ---
2 | engines:
3 | csslint:
4 | enabled: true
5 | duplication:
6 | enabled: true
7 | config:
8 | languages:
9 | - ruby
10 | - javascript
11 | - python
12 | - php
13 | eslint:
14 | enabled: true
15 | fixme:
16 | enabled: true
17 | phpmd:
18 | enabled: true
19 | ratings:
20 | paths:
21 | - "**.css"
22 | - "**.inc"
23 | - "**.js"
24 | - "**.jsx"
25 | - "**.module"
26 | - "**.php"
27 | - "**.py"
28 | - "**.rb"
29 | exclude_paths:
30 | - tests/
31 | - vendor/
32 | - SampleApp_RoadPlanner/
33 | - doc/
34 |
--------------------------------------------------------------------------------
/.csslintrc:
--------------------------------------------------------------------------------
1 | --exclude-exts=.min.css
2 | --ignore=adjoining-classes,box-model,ids,order-alphabetical,unqualified-attributes
3 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | **/*{.,-}min.js
2 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | ecmaFeatures:
2 | modules: true
3 | jsx: true
4 |
5 | env:
6 | amd: true
7 | browser: true
8 | es6: true
9 | jquery: true
10 | node: true
11 |
12 | # http://eslint.org/docs/rules/
13 | rules:
14 | # Possible Errors
15 | comma-dangle: [2, never]
16 | no-cond-assign: 2
17 | no-console: 0
18 | no-constant-condition: 2
19 | no-control-regex: 2
20 | no-debugger: 2
21 | no-dupe-args: 2
22 | no-dupe-keys: 2
23 | no-duplicate-case: 2
24 | no-empty: 2
25 | no-empty-character-class: 2
26 | no-ex-assign: 2
27 | no-extra-boolean-cast: 2
28 | no-extra-parens: 0
29 | no-extra-semi: 2
30 | no-func-assign: 2
31 | no-inner-declarations: [2, functions]
32 | no-invalid-regexp: 2
33 | no-irregular-whitespace: 2
34 | no-negated-in-lhs: 2
35 | no-obj-calls: 2
36 | no-regex-spaces: 2
37 | no-sparse-arrays: 2
38 | no-unexpected-multiline: 2
39 | no-unreachable: 2
40 | use-isnan: 2
41 | valid-jsdoc: 0
42 | valid-typeof: 2
43 |
44 | # Best Practices
45 | accessor-pairs: 2
46 | block-scoped-var: 0
47 | complexity: [2, 6]
48 | consistent-return: 0
49 | curly: 0
50 | default-case: 0
51 | dot-location: 0
52 | dot-notation: 0
53 | eqeqeq: 2
54 | guard-for-in: 2
55 | no-alert: 2
56 | no-caller: 2
57 | no-case-declarations: 2
58 | no-div-regex: 2
59 | no-else-return: 0
60 | no-empty-label: 2
61 | no-empty-pattern: 2
62 | no-eq-null: 2
63 | no-eval: 2
64 | no-extend-native: 2
65 | no-extra-bind: 2
66 | no-fallthrough: 2
67 | no-floating-decimal: 0
68 | no-implicit-coercion: 0
69 | no-implied-eval: 2
70 | no-invalid-this: 0
71 | no-iterator: 2
72 | no-labels: 0
73 | no-lone-blocks: 2
74 | no-loop-func: 2
75 | no-magic-number: 0
76 | no-multi-spaces: 0
77 | no-multi-str: 0
78 | no-native-reassign: 2
79 | no-new-func: 2
80 | no-new-wrappers: 2
81 | no-new: 2
82 | no-octal-escape: 2
83 | no-octal: 2
84 | no-proto: 2
85 | no-redeclare: 2
86 | no-return-assign: 2
87 | no-script-url: 2
88 | no-self-compare: 2
89 | no-sequences: 0
90 | no-throw-literal: 0
91 | no-unused-expressions: 2
92 | no-useless-call: 2
93 | no-useless-concat: 2
94 | no-void: 2
95 | no-warning-comments: 0
96 | no-with: 2
97 | radix: 2
98 | vars-on-top: 0
99 | wrap-iife: 2
100 | yoda: 0
101 |
102 | # Strict
103 | strict: 0
104 |
105 | # Variables
106 | init-declarations: 0
107 | no-catch-shadow: 2
108 | no-delete-var: 2
109 | no-label-var: 2
110 | no-shadow-restricted-names: 2
111 | no-shadow: 0
112 | no-undef-init: 2
113 | no-undef: 0
114 | no-undefined: 0
115 | no-unused-vars: 0
116 | no-use-before-define: 0
117 |
118 | # Node.js and CommonJS
119 | callback-return: 2
120 | global-require: 2
121 | handle-callback-err: 2
122 | no-mixed-requires: 0
123 | no-new-require: 0
124 | no-path-concat: 2
125 | no-process-exit: 2
126 | no-restricted-modules: 0
127 | no-sync: 0
128 |
129 | # Stylistic Issues
130 | array-bracket-spacing: 0
131 | block-spacing: 0
132 | brace-style: 0
133 | camelcase: 0
134 | comma-spacing: 0
135 | comma-style: 0
136 | computed-property-spacing: 0
137 | consistent-this: 0
138 | eol-last: 0
139 | func-names: 0
140 | func-style: 0
141 | id-length: 0
142 | id-match: 0
143 | indent: 0
144 | jsx-quotes: 0
145 | key-spacing: 0
146 | linebreak-style: 0
147 | lines-around-comment: 0
148 | max-depth: 0
149 | max-len: 0
150 | max-nested-callbacks: 0
151 | max-params: 0
152 | max-statements: [2, 30]
153 | new-cap: 0
154 | new-parens: 0
155 | newline-after-var: 0
156 | no-array-constructor: 0
157 | no-bitwise: 0
158 | no-continue: 0
159 | no-inline-comments: 0
160 | no-lonely-if: 0
161 | no-mixed-spaces-and-tabs: 0
162 | no-multiple-empty-lines: 0
163 | no-negated-condition: 0
164 | no-nested-ternary: 0
165 | no-new-object: 0
166 | no-plusplus: 0
167 | no-restricted-syntax: 0
168 | no-spaced-func: 0
169 | no-ternary: 0
170 | no-trailing-spaces: 0
171 | no-underscore-dangle: 0
172 | no-unneeded-ternary: 0
173 | object-curly-spacing: 0
174 | one-var: 0
175 | operator-assignment: 0
176 | operator-linebreak: 0
177 | padded-blocks: 0
178 | quote-props: 0
179 | quotes: 0
180 | require-jsdoc: 0
181 | semi-spacing: 0
182 | semi: 0
183 | sort-vars: 0
184 | space-after-keywords: 0
185 | space-before-blocks: 0
186 | space-before-function-paren: 0
187 | space-before-keywords: 0
188 | space-in-parens: 0
189 | space-infix-ops: 0
190 | space-return-throw-case: 0
191 | space-unary-ops: 0
192 | spaced-comment: 0
193 | wrap-regex: 0
194 |
195 | # ECMAScript 6
196 | arrow-body-style: 0
197 | arrow-parens: 0
198 | arrow-spacing: 0
199 | constructor-super: 0
200 | generator-star-spacing: 0
201 | no-arrow-condition: 0
202 | no-class-assign: 0
203 | no-const-assign: 0
204 | no-dupe-class-members: 0
205 | no-this-before-super: 0
206 | no-var: 0
207 | object-shorthand: 0
208 | prefer-arrow-callback: 0
209 | prefer-const: 0
210 | prefer-reflect: 0
211 | prefer-spread: 0
212 | prefer-template: 0
213 | require-yield: 0
214 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | vendor/
2 | .DS_Store
3 | test.php
4 | test.graphml
5 | build
6 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | env:
2 | global:
3 | - CC_TEST_REPORTER_ID=af2053e44f0ad6a8e045593ee7bca05ea7e95cefe142ac82770729b481003779
4 | - GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
5 | language: php
6 | php:
7 | - '5.4'
8 | - '5.6'
9 | - '7.0'
10 | - '7.1'
11 | - '7.2'
12 | before_script:
13 | - composer install --no-dev
14 | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
15 | - chmod +x ./cc-test-reporter
16 | - ./cc-test-reporter before-build
17 | script:
18 | - "phpunit --coverage-text --coverage-clover build/logs/clover.xml"
19 | - if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build -t clover --exit-code $TRAVIS_TEST_RESULT; fi
20 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM composer:latest
2 |
3 | ADD . /app
4 |
5 | RUN php --version
6 |
7 | WORKDIR /app
8 |
9 | RUN composer install --no-interaction --no-plugins --no-scripts --prefer-dist
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2016
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/SampleApp_RoadPlanner/src/data/X.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/SampleApp_RoadPlanner/src/data/X.png
--------------------------------------------------------------------------------
/SampleApp_RoadPlanner/src/data/germany.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/SampleApp_RoadPlanner/src/data/germany.png
--------------------------------------------------------------------------------
/SampleApp_RoadPlanner/src/data/roads.json:
--------------------------------------------------------------------------------
1 | {
2 | "countries": {
3 | "Germany": {
4 | "map_img": "germany.png",
5 | "locations": {
6 | "Hamburg": {
7 | "map_x": 275,
8 | "map_y": 77
9 | },
10 | "Bremen": {
11 | "map_x": 205,
12 | "map_y": 107
13 | },
14 | "Berlin": {
15 | "map_x": 452,
16 | "map_y": 163
17 | },
18 | "Hannover": {
19 | "map_x": 262,
20 | "map_y": 168
21 | },
22 | "Dortmund": {
23 | "map_x": 139,
24 | "map_y": 238
25 | },
26 | "Cologne": {
27 | "map_x": 109,
28 | "map_y": 290
29 | },
30 | "Bonn": {
31 | "map_x": 116,
32 | "map_y": 318
33 | },
34 | "Frankfurt": {
35 | "map_x": 203,
36 | "map_y": 368
37 | },
38 | "Nurnberg": {
39 | "map_x": 333,
40 | "map_y": 427
41 | },
42 | "Stuttgart": {
43 | "map_x": 231,
44 | "map_y": 478
45 | },
46 | "Munich": {
47 | "map_x": 361,
48 | "map_y": 528
49 | }
50 | },
51 | "paths": {
52 | "Hamburg": {
53 | "Bremen": {
54 | "distance": "130"
55 | },
56 | "Hannover": {
57 | "distance": "170"
58 | },
59 | "Berlin": {
60 | "distance": "290"
61 | }
62 | },
63 | "Bremen": {
64 | "Hannover": {
65 | "distance": "140"
66 | }
67 | },
68 | "Berlin": {
69 | "Hannover": {
70 | "distance": "290"
71 | },
72 | "Nurnberg": {
73 | "distance": "440"
74 | }
75 | },
76 | "Hannover": {
77 | "Dortmund": {
78 | "distance": "210"
79 | },
80 | "Frankfurt": {
81 | "distance": "350"
82 | },
83 | "Nurnberg": {
84 | "distance": "470"
85 | }
86 | },
87 | "Dortmund": {
88 | "Cologne": {
89 | "distance": "90"
90 | }
91 | },
92 | "Cologne": {
93 | "Bonn": {
94 | "distance": "30"
95 | }
96 | },
97 | "Bonn": {
98 | "Frankfurt": {
99 | "distance": "160"
100 | }
101 | },
102 | "Frankfurt": {
103 | "Stuttgart": {
104 | "distance": "200"
105 | }
106 | },
107 | "Nurnberg": {
108 | "Stuttgart": {
109 | "distance": "30"
110 | },
111 | "Munich": {
112 | "distance": "170"
113 | }
114 | },
115 | "Stuttgart": {
116 | "Munich": {
117 | "distance": "240"
118 | }
119 | }
120 | }
121 | },
122 | "X": {
123 | "map_img": "X.png",
124 | "locations": {
125 | "A": {
126 | "map_x": 57,
127 | "map_y": 473
128 | },
129 | "B": {
130 | "map_x": 423,
131 | "map_y": 303
132 | },
133 | "C": {
134 | "map_x": 272,
135 | "map_y": 470
136 | },
137 | "D": {
138 | "map_x": 426,
139 | "map_y": 415
140 | },
141 | "E": {
142 | "map_x": 423,
143 | "map_y": 527
144 | },
145 | "F": {
146 | "map_x": 559,
147 | "map_y": 468
148 | },
149 | "G": {
150 | "map_x": 284,
151 | "map_y": 588
152 | },
153 | "H": {
154 | "map_x": 423,
155 | "map_y": 660
156 | },
157 | "I": {
158 | "map_x": 557,
159 | "map_y": 661
160 | },
161 | "J": {
162 | "map_x": 740,
163 | "map_y": 465
164 | },
165 | "K": {
166 | "map_x": 970,
167 | "map_y": 462
168 | }
169 | },
170 | "paths": {
171 | "A": {
172 | "B": {
173 | "distance": "5"
174 | },
175 | "C": {
176 | "distance": "3"
177 | },
178 | "G": {
179 | "distance": "3"
180 | }
181 | },
182 | "B": {
183 | "F": {
184 | "distance": "3"
185 | },
186 | "J": {
187 | "distance": "5"
188 | },
189 | "K": {
190 | "distance": "2"
191 | }
192 | },
193 | "C": {
194 | "B": {
195 | "distance": "3"
196 | },
197 | "D": {
198 | "distance": "2"
199 | },
200 | "E": {
201 | "distance": "1"
202 | }
203 | },
204 | "D": {
205 | "F": {
206 | "distance": "2"
207 | }
208 | },
209 | "E": {
210 | "F": {
211 | "distance": "3"
212 | }
213 | },
214 | "F": {
215 | "I": {
216 | "distance": "2"
217 | },
218 | "J": {
219 | "distance": "3"
220 | }
221 | },
222 | "G": {
223 | "E": {
224 | "distance": "4"
225 | },
226 | "H": {
227 | "distance": "3"
228 | }
229 | },
230 | "H": {
231 | "I": {
232 | "distance": "2"
233 | }
234 | },
235 | "I": {
236 | "J": {
237 | "distance": "2"
238 | },
239 | "K": {
240 | "distance": "3"
241 | }
242 | },
243 | "J": {
244 | "K": {
245 | "distance": "7"
246 | }
247 | }
248 | }
249 | }
250 | }
251 | }
252 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "algb12/graph-ds",
3 | "description": "A fast implementation of the graph data-structure in PHP",
4 | "license": "MIT",
5 | "authors": [
6 | {
7 | "name": "Alex Gilburg",
8 | "email": "algb12.19@gmail.com"
9 | }
10 | ],
11 | "minimum-stability": "dev",
12 | "autoload": {
13 | "psr-4": {
14 | "GraphDS\\": "src",
15 | "Tests\\": "tests"
16 | }
17 | },
18 | "require": {
19 | "php": ">=5.3.0",
20 | "ext-dom": "*",
21 | "ext-simplexml": "*"
22 | },
23 | "require-dev": {
24 | "php": ">=5.4",
25 | "phpunit/phpunit": "7.0.*",
26 | "codeclimate/php-test-reporter": "^0.4.4"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/doc/.htaccess:
--------------------------------------------------------------------------------
1 | # Fixes a vulnerability in CentOS: http://stackoverflow.com/questions/20533279/prevent-php-from-parsing-non-php-files-such-as-somefile-php-txt
2 |
3 | RemoveHandler .php
4 | ForceType text/plain
5 |
--------------------------------------------------------------------------------
/doc/css/jquery.iviewer.css:
--------------------------------------------------------------------------------
1 | .viewer {
2 | -ms-touch-action: none;
3 | }
4 |
5 | .iviewer_common {
6 | position:absolute;
7 | bottom:10px;
8 | border: 1px solid #000;
9 | height: 28px;
10 | z-index: 5000;
11 | }
12 |
13 | .iviewer_cursor {
14 | cursor: url(../images/iviewer/hand.cur) 6 8, pointer;
15 | }
16 |
17 | .iviewer_drag_cursor {
18 | cursor: url(../images/iviewer/grab.cur) 6 8, pointer;
19 | }
20 |
21 | .iviewer_button {
22 | width: 28px;
23 | cursor: pointer;
24 | background-position: center center;
25 | background-repeat: no-repeat;
26 | }
27 |
28 | .iviewer_zoom_in {
29 | left: 20px;
30 | background: url(../images/iviewer/iviewer.zoom_in.png);
31 | }
32 |
33 | .iviewer_zoom_out {
34 | left: 55px;
35 | background: url(../images/iviewer/iviewer.zoom_out.png);
36 | }
37 |
38 | .iviewer_zoom_zero {
39 | left: 90px;
40 | background: url(../images/iviewer/iviewer.zoom_zero.png);
41 | }
42 |
43 | .iviewer_zoom_fit {
44 | left: 125px;
45 | background: url(../images/iviewer/iviewer.zoom_fit.png);
46 | }
47 |
48 | .iviewer_zoom_status {
49 | left: 160px;
50 | font: 1em/28px Sans;
51 | color: #000;
52 | background-color: #fff;
53 | text-align: center;
54 | width: 60px;
55 | }
56 |
57 | .iviewer_rotate_left {
58 | left: 227px;
59 | background: #fff url(../images/iviewer/iviewer.rotate_left.png) center center no-repeat;
60 | }
61 |
62 | .iviewer_rotate_right {
63 | left: 262px;
64 | background: #fff url(../images/iviewer/iviewer.rotate_right.png) center center no-repeat;
65 | }
66 |
--------------------------------------------------------------------------------
/doc/css/phpdocumentor-clean-icons/Read Me.txt:
--------------------------------------------------------------------------------
1 | To modify your generated font, use the *dev.svg* file, located in the *fonts* folder in this package. You can import this dev.svg file to the IcoMoon app. All the tags (class names) and the Unicode points of your glyphs are saved in this file.
2 |
3 | See the documentation for more info on how to use this package: http://icomoon.io/#docs/font-face
--------------------------------------------------------------------------------
/doc/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.dev.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/doc/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.eot
--------------------------------------------------------------------------------
/doc/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/doc/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.ttf
--------------------------------------------------------------------------------
/doc/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/css/phpdocumentor-clean-icons/fonts/phpdocumentor-clean-icons.woff
--------------------------------------------------------------------------------
/doc/css/phpdocumentor-clean-icons/lte-ie7.js:
--------------------------------------------------------------------------------
1 | /* Load this script using conditional IE comments if you need to support IE 7 and IE 6. */
2 |
3 | window.onload = function() {
4 | function addIcon(el, entity) {
5 | var html = el.innerHTML;
6 | el.innerHTML = '' + entity + '' + html;
7 | }
8 | var icons = {
9 | 'icon-trait' : '',
10 | 'icon-interface' : '',
11 | 'icon-class' : ''
12 | },
13 | els = document.getElementsByTagName('*'),
14 | i, attr, html, c, el;
15 | for (i = 0; ; i += 1) {
16 | el = els[i];
17 | if(!el) {
18 | break;
19 | }
20 | attr = el.getAttribute('data-icon');
21 | if (attr) {
22 | addIcon(el, attr);
23 | }
24 | c = el.className;
25 | c = c.match(/icon-[^\s'"]+/);
26 | if (c && icons[c[0]]) {
27 | addIcon(el, icons[c[0]]);
28 | }
29 | }
30 | };
--------------------------------------------------------------------------------
/doc/css/phpdocumentor-clean-icons/style.css:
--------------------------------------------------------------------------------
1 | @font-face {
2 | font-family: 'phpdocumentor-clean-icons';
3 | src:url('fonts/phpdocumentor-clean-icons.eot');
4 | src:url('fonts/phpdocumentor-clean-icons.eot?#iefix') format('embedded-opentype'),
5 | url('fonts/phpdocumentor-clean-icons.woff') format('woff'),
6 | url('fonts/phpdocumentor-clean-icons.ttf') format('truetype'),
7 | url('fonts/phpdocumentor-clean-icons.svg#phpdocumentor-clean-icons') format('svg');
8 | font-weight: normal;
9 | font-style: normal;
10 | }
11 |
12 | /* Use the following CSS code if you want to use data attributes for inserting your icons */
13 | [data-icon]:before {
14 | font-family: 'phpdocumentor-clean-icons';
15 | content: attr(data-icon);
16 | speak: none;
17 | font-weight: normal;
18 | font-variant: normal;
19 | text-transform: none;
20 | line-height: 1;
21 | -webkit-font-smoothing: antialiased;
22 | }
23 |
24 | /* Use the following CSS code if you want to have a class per icon */
25 | /*
26 | Instead of a list of all class selectors,
27 | you can use the generic selector below, but it's slower:
28 | [class*="icon-"] {
29 | */
30 | .icon-trait, .icon-interface, .icon-class {
31 | font-family: 'phpdocumentor-clean-icons';
32 | speak: none;
33 | font-style: normal;
34 | font-weight: normal;
35 | font-variant: normal;
36 | text-transform: none;
37 | line-height: 1;
38 | -webkit-font-smoothing: antialiased;
39 | }
40 | .icon-trait:before {
41 | content: "\e000";
42 | }
43 | .icon-interface:before {
44 | content: "\e001";
45 | }
46 | .icon-class:before {
47 | content: "\e002";
48 | }
49 |
--------------------------------------------------------------------------------
/doc/css/prism.css:
--------------------------------------------------------------------------------
1 | /**
2 | * prism.js default theme for JavaScript, CSS and HTML
3 | * Based on dabblet (http://dabblet.com)
4 | * @author Lea Verou
5 | */
6 |
7 | code[class*="language-"],
8 | pre[class*="language-"] {
9 | color: black;
10 | text-shadow: 0 1px white;
11 | font-family: Consolas, Monaco, 'Andale Mono', monospace;
12 | direction: ltr;
13 | text-align: left;
14 | white-space: pre;
15 | word-spacing: normal;
16 |
17 | -moz-tab-size: 4;
18 | -o-tab-size: 4;
19 | tab-size: 4;
20 |
21 | -webkit-hyphens: none;
22 | -moz-hyphens: none;
23 | -ms-hyphens: none;
24 | hyphens: none;
25 | }
26 |
27 | ::-moz-selection {
28 | text-shadow: none;
29 | background: #b3d4fc;
30 | }
31 |
32 | ::selection {
33 | text-shadow: none;
34 | background: #b3d4fc;
35 | }
36 |
37 | @media print {
38 | code[class*="language-"],
39 | pre[class*="language-"] {
40 | text-shadow: none;
41 | }
42 | }
43 |
44 | /* Code blocks */
45 | pre[class*="language-"] {
46 | padding: 1em;
47 | margin: .5em 0;
48 | overflow: auto;
49 | }
50 |
51 | :not(pre) > code[class*="language-"],
52 | pre[class*="language-"] {
53 | background: #f5f2f0;
54 | }
55 |
56 | /* Inline code */
57 | :not(pre) > code[class*="language-"] {
58 | padding: .1em;
59 | border-radius: .3em;
60 | }
61 |
62 | .token.comment,
63 | .token.prolog,
64 | .token.doctype,
65 | .token.cdata {
66 | color: slategray;
67 | }
68 |
69 | .token.punctuation {
70 | color: #999;
71 | }
72 |
73 | .namespace {
74 | opacity: .7;
75 | }
76 |
77 | .token.property,
78 | .token.tag,
79 | .token.boolean,
80 | .token.number {
81 | color: #905;
82 | }
83 |
84 | .token.selector,
85 | .token.attr-name,
86 | .token.string {
87 | color: #690;
88 | }
89 |
90 | .token.operator,
91 | .token.entity,
92 | .token.url,
93 | .language-css .token.string,
94 | .style .token.string {
95 | color: #a67f59;
96 | background: hsla(0,0%,100%,.5);
97 | }
98 |
99 | .token.atrule,
100 | .token.attr-value,
101 | .token.keyword {
102 | color: #07a;
103 | }
104 |
105 |
106 | .token.regex,
107 | .token.important {
108 | color: #e90;
109 | }
110 |
111 | .token.important {
112 | font-weight: bold;
113 | }
114 |
115 | .token.entity {
116 | cursor: help;
117 | }
118 | pre[data-line] {
119 | position: relative;
120 | padding: 1em 0 1em 3em;
121 | }
122 |
123 | .line-highlight {
124 | position: absolute;
125 | left: 0;
126 | right: 0;
127 | padding: inherit 0;
128 | margin-top: 1em; /* Same as .prism’s padding-top */
129 |
130 | background: hsla(24, 20%, 50%,.08);
131 | background: -moz-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
132 | background: -webkit-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
133 | background: -o-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
134 | background: linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
135 |
136 | pointer-events: none;
137 |
138 | line-height: inherit;
139 | white-space: pre;
140 | }
141 |
142 | .line-highlight:before,
143 | .line-highlight[data-end]:after {
144 | content: attr(data-start);
145 | position: absolute;
146 | top: .4em;
147 | left: .6em;
148 | min-width: 1em;
149 | padding: 0 .5em;
150 | background-color: hsla(24, 20%, 50%,.4);
151 | color: hsl(24, 20%, 95%);
152 | font: bold 65%/1.5 sans-serif;
153 | text-align: center;
154 | vertical-align: .3em;
155 | border-radius: 999px;
156 | text-shadow: none;
157 | box-shadow: 0 1px white;
158 | }
159 |
160 | .line-highlight[data-end]:after {
161 | content: attr(data-end);
162 | top: auto;
163 | bottom: .4em;
164 | }
165 | pre.line-numbers {
166 | position: relative;
167 | padding-left: 3.8em;
168 | counter-reset: linenumber;
169 | }
170 |
171 | pre.line-numbers > code {
172 | position: relative;
173 | }
174 |
175 | .line-numbers .line-numbers-rows {
176 | position: absolute;
177 | pointer-events: none;
178 | top: 0;
179 | font-size: 100%;
180 | left: -3.8em;
181 | width: 3em; /* works for line-numbers below 1000 lines */
182 | letter-spacing: -1px;
183 | border-right: 1px solid #999;
184 |
185 | -webkit-user-select: none;
186 | -moz-user-select: none;
187 | -ms-user-select: none;
188 | user-select: none;
189 |
190 | }
191 |
192 | .line-numbers-rows > span {
193 | pointer-events: none;
194 | display: block;
195 | counter-increment: linenumber;
196 | }
197 |
198 | .line-numbers-rows > span:before {
199 | content: counter(linenumber);
200 | color: #999;
201 | display: block;
202 | padding-right: 0.8em;
203 | text-align: right;
204 | }
205 |
--------------------------------------------------------------------------------
/doc/files/Algo/BFS.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Algo/DFS.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Algo/Dijkstra.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Algo/DijkstraMulti.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Algo/FloydWarshall.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Edge/DirectedEdge.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Edge/Edge.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Edge/UndirectedEdge.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Graph/DirectedGraph.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Graph/Graph.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Graph/UndirectedGraph.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Persistence/ExportGraph.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Persistence/ImportGraph.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Vertex/DirectedVertex.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Vertex/UndirectedVertex.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/files/Vertex/Vertex.php.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/doc/font/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/font/FontAwesome.otf
--------------------------------------------------------------------------------
/doc/font/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/font/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/doc/font/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/font/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/doc/font/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/font/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/doc/images/apple-touch-icon-114x114.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/apple-touch-icon-114x114.png
--------------------------------------------------------------------------------
/doc/images/apple-touch-icon-72x72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/apple-touch-icon-72x72.png
--------------------------------------------------------------------------------
/doc/images/apple-touch-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/apple-touch-icon.png
--------------------------------------------------------------------------------
/doc/images/custom-icons.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
117 |
--------------------------------------------------------------------------------
/doc/images/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/favicon.ico
--------------------------------------------------------------------------------
/doc/images/hierarchy-item.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/hierarchy-item.png
--------------------------------------------------------------------------------
/doc/images/icon-class-13x13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/icon-class-13x13.png
--------------------------------------------------------------------------------
/doc/images/icon-class.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
78 |
--------------------------------------------------------------------------------
/doc/images/icon-interface-13x13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/icon-interface-13x13.png
--------------------------------------------------------------------------------
/doc/images/icon-interface.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
74 |
--------------------------------------------------------------------------------
/doc/images/icon-trait-13x13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/icon-trait-13x13.png
--------------------------------------------------------------------------------
/doc/images/icon-trait.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
74 |
--------------------------------------------------------------------------------
/doc/images/iviewer/grab.cur:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/iviewer/grab.cur
--------------------------------------------------------------------------------
/doc/images/iviewer/hand.cur:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/iviewer/hand.cur
--------------------------------------------------------------------------------
/doc/images/iviewer/iviewer.rotate_left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/iviewer/iviewer.rotate_left.png
--------------------------------------------------------------------------------
/doc/images/iviewer/iviewer.rotate_right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/iviewer/iviewer.rotate_right.png
--------------------------------------------------------------------------------
/doc/images/iviewer/iviewer.zoom_fit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/iviewer/iviewer.zoom_fit.png
--------------------------------------------------------------------------------
/doc/images/iviewer/iviewer.zoom_in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/iviewer/iviewer.zoom_in.png
--------------------------------------------------------------------------------
/doc/images/iviewer/iviewer.zoom_out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/iviewer/iviewer.zoom_out.png
--------------------------------------------------------------------------------
/doc/images/iviewer/iviewer.zoom_zero.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/algb12/GraphDS/be91927b9b88aa83a4c261b908afc9dd4837956a/doc/images/iviewer/iviewer.zoom_zero.png
--------------------------------------------------------------------------------
/doc/js/html5.js:
--------------------------------------------------------------------------------
1 | /*
2 | HTML5 Shiv v3.7.0 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
3 | */
4 | (function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
5 | a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/[\w\-]+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x";
6 | c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
7 | "undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:"3.7.0",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);
8 | if(g)return a.createDocumentFragment();for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;dg;g++){var i=d.eq(g);if(a.append(i),c&&a.append(c),f(a,b)){i.remove(),e=!0;break}c&&c.remove()}return e}function d(b,c,g,h,i){var j=b.contents(),k=!1;b.empty();for(var l="table, thead, tbody, tfoot, tr, col, colgroup, object, embed, param, ol, ul, dl, select, optgroup, option, textarea, script, style",m=0,n=j.length;n>m&&!k;m++){var o=j[m],p=a(o);void 0!==o&&(b.append(p),i&&b[b.is(l)?"after":"append"](i),3==o.nodeType?f(g,h)&&(k=e(p,c,g,h,i)):k=d(p,c,g,h,i),k||i&&i.remove())}return k}function e(a,b,c,d,h){var k=!1,l=a[0];if(l===void 0)return!1;for(var m="letter"==d.wrap?"":" ",n=j(l).split(m),o=-1,p=-1,q=0,r=n.length-1;r>=q;){var s=Math.floor((q+r)/2);if(s==p)break;p=s,i(l,n.slice(0,p+1).join(m)+d.ellipsis),f(c,d)?r=p:(o=p,q=p)}if(-1==o||1==n.length&&0==n[0].length){var u=a.parent();a.remove();var v=h?h.length:0;if(u.contents().size()>v){var w=u.contents().eq(-1-v);k=e(w,b,c,d,h)}else{var x=u.prev(),l=x.contents().eq(-1)[0];if(l!==void 0){var t=g(j(l),d);i(l,t),h&&x.append(h),u.remove(),k=!0}}}else{var t=g(n.slice(0,o+1).join(m),d);k=!0,i(l,t)}return k}function f(a,b){return a.innerHeight()>b.maxHeight}function g(b,c){for(;a.inArray(b.slice(-1),c.lastCharacter.remove)>-1;)b=b.slice(0,-1);return 0>a.inArray(b.slice(-1),c.lastCharacter.noEllipsis)&&(b+=c.ellipsis),b}function h(a){return{width:a.innerWidth(),height:a.innerHeight()}}function i(a,b){a.innerText?a.innerText=b:a.nodeValue?a.nodeValue=b:a.textContent&&(a.textContent=b)}function j(a){return a.innerText?a.innerText:a.nodeValue?a.nodeValue:a.textContent?a.textContent:""}function k(b,c){return b===void 0?!1:b?"string"==typeof b?(b=a(b,c),b.length?b:!1):"object"==typeof b?b.jquery===void 0?!1:b:!1:!1}function l(a){for(var b=a.innerHeight(),c=["paddingTop","paddingBottom"],d=0,e=c.length;e>d;d++){var f=parseInt(a.css(c[d]),10);isNaN(f)&&(f=0),b-=f}return b}function m(a,b){return a?(b="string"==typeof b?"dotdotdot: "+b:["dotdotdot:",b],window.console!==void 0&&window.console.log!==void 0&&window.console.log(b),!1):!1}if(!a.fn.dotdotdot){a.fn.dotdotdot=function(e){if(0==this.length)return e&&e.debug===!1||m(!0,'No element found for "'+this.selector+'".'),this;if(this.length>1)return this.each(function(){a(this).dotdotdot(e)});var g=this;g.data("dotdotdot")&&g.trigger("destroy.dot"),g.data("dotdotdot-style",g.attr("style")),g.css("word-wrap","break-word"),g.bind_events=function(){return g.bind("update.dot",function(b,e){b.preventDefault(),b.stopPropagation(),j.maxHeight="number"==typeof j.height?j.height:l(g),j.maxHeight+=j.tolerance,e!==void 0&&(("string"==typeof e||e instanceof HTMLElement)&&(e=a("").append(e).contents()),e instanceof a&&(i=e)),q=g.wrapInner('').children(),q.empty().append(i.clone(!0)).css({height:"auto",width:"auto",border:"none",padding:0,margin:0});var h=!1,k=!1;return n.afterElement&&(h=n.afterElement.clone(!0),n.afterElement.remove()),f(q,j)&&(k="children"==j.wrap?c(q,j,h):d(q,g,q,j,h)),q.replaceWith(q.contents()),q=null,a.isFunction(j.callback)&&j.callback.call(g[0],k,i),n.isTruncated=k,k}).bind("isTruncated.dot",function(a,b){return a.preventDefault(),a.stopPropagation(),"function"==typeof b&&b.call(g[0],n.isTruncated),n.isTruncated}).bind("originalContent.dot",function(a,b){return a.preventDefault(),a.stopPropagation(),"function"==typeof b&&b.call(g[0],i),i}).bind("destroy.dot",function(a){a.preventDefault(),a.stopPropagation(),g.unwatch().unbind_events().empty().append(i).attr("style",g.data("dotdotdot-style")).data("dotdotdot",!1)}),g},g.unbind_events=function(){return g.unbind(".dot"),g},g.watch=function(){if(g.unwatch(),"window"==j.watch){var b=a(window),c=b.width(),d=b.height();b.bind("resize.dot"+n.dotId,function(){c==b.width()&&d==b.height()&&j.windowResizeFix||(c=b.width(),d=b.height(),p&&clearInterval(p),p=setTimeout(function(){g.trigger("update.dot")},10))})}else o=h(g),p=setInterval(function(){var a=h(g);(o.width!=a.width||o.height!=a.height)&&(g.trigger("update.dot"),o=h(g))},100);return g},g.unwatch=function(){return a(window).unbind("resize.dot"+n.dotId),p&&clearInterval(p),g};var i=g.contents(),j=a.extend(!0,{},a.fn.dotdotdot.defaults,e),n={},o={},p=null,q=null;return n.afterElement=k(j.after,g),n.isTruncated=!1,n.dotId=b++,g.data("dotdotdot",!0).bind_events().trigger("update.dot"),j.watch&&g.watch(),g},a.fn.dotdotdot.defaults={ellipsis:"... ",wrap:"word",lastCharacter:{remove:[" ",",",";",".","!","?"],noEllipsis:[]},tolerance:0,callback:null,after:null,height:null,watch:!1,windowResizeFix:!0,debug:!1};var b=1,n=a.fn.html;a.fn.html=function(a){return a!==void 0?this.data("dotdotdot")&&"function"!=typeof a?this.trigger("update",[a]):n.call(this,a):n.call(this)};var o=a.fn.text;a.fn.text=function(b){if(b!==void 0){if(this.data("dotdotdot")){var c=a("");return c.text(b),b=c.html(),c.remove(),this.trigger("update",[b])}return o.call(this,b)}return o.call(this)}}})(jQuery);
--------------------------------------------------------------------------------
/doc/js/jquery.mousewheel.js:
--------------------------------------------------------------------------------
1 | /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh)
2 | * Licensed under the MIT License (LICENSE.txt).
3 | *
4 | * Version: 3.1.9
5 | *
6 | * Requires: jQuery 1.2.2+
7 | */
8 |
9 | (function (factory) {
10 | if ( typeof define === 'function' && define.amd ) {
11 | // AMD. Register as an anonymous module.
12 | define(['jquery'], factory);
13 | } else if (typeof exports === 'object') {
14 | // Node/CommonJS style for Browserify
15 | module.exports = factory;
16 | } else {
17 | // Browser globals
18 | factory(jQuery);
19 | }
20 | }(function ($) {
21 |
22 | var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
23 | toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
24 | ['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
25 | slice = Array.prototype.slice,
26 | nullLowestDeltaTimeout, lowestDelta;
27 |
28 | if ( $.event.fixHooks ) {
29 | for ( var i = toFix.length; i; ) {
30 | $.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
31 | }
32 | }
33 |
34 | var special = $.event.special.mousewheel = {
35 | version: '3.1.9',
36 |
37 | setup: function() {
38 | if ( this.addEventListener ) {
39 | for ( var i = toBind.length; i; ) {
40 | this.addEventListener( toBind[--i], handler, false );
41 | }
42 | } else {
43 | this.onmousewheel = handler;
44 | }
45 | // Store the line height and page height for this particular element
46 | $.data(this, 'mousewheel-line-height', special.getLineHeight(this));
47 | $.data(this, 'mousewheel-page-height', special.getPageHeight(this));
48 | },
49 |
50 | teardown: function() {
51 | if ( this.removeEventListener ) {
52 | for ( var i = toBind.length; i; ) {
53 | this.removeEventListener( toBind[--i], handler, false );
54 | }
55 | } else {
56 | this.onmousewheel = null;
57 | }
58 | },
59 |
60 | getLineHeight: function(elem) {
61 | return parseInt($(elem)['offsetParent' in $.fn ? 'offsetParent' : 'parent']().css('fontSize'), 10);
62 | },
63 |
64 | getPageHeight: function(elem) {
65 | return $(elem).height();
66 | },
67 |
68 | settings: {
69 | adjustOldDeltas: true
70 | }
71 | };
72 |
73 | $.fn.extend({
74 | mousewheel: function(fn) {
75 | return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
76 | },
77 |
78 | unmousewheel: function(fn) {
79 | return this.unbind('mousewheel', fn);
80 | }
81 | });
82 |
83 |
84 | function handler(event) {
85 | var orgEvent = event || window.event,
86 | args = slice.call(arguments, 1),
87 | delta = 0,
88 | deltaX = 0,
89 | deltaY = 0,
90 | absDelta = 0;
91 | event = $.event.fix(orgEvent);
92 | event.type = 'mousewheel';
93 |
94 | // Old school scrollwheel delta
95 | if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
96 | if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
97 | if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
98 | if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
99 |
100 | // Firefox < 17 horizontal scrolling related to DOMMouseScroll event
101 | if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
102 | deltaX = deltaY * -1;
103 | deltaY = 0;
104 | }
105 |
106 | // Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
107 | delta = deltaY === 0 ? deltaX : deltaY;
108 |
109 | // New school wheel delta (wheel event)
110 | if ( 'deltaY' in orgEvent ) {
111 | deltaY = orgEvent.deltaY * -1;
112 | delta = deltaY;
113 | }
114 | if ( 'deltaX' in orgEvent ) {
115 | deltaX = orgEvent.deltaX;
116 | if ( deltaY === 0 ) { delta = deltaX * -1; }
117 | }
118 |
119 | // No change actually happened, no reason to go any further
120 | if ( deltaY === 0 && deltaX === 0 ) { return; }
121 |
122 | // Need to convert lines and pages to pixels if we aren't already in pixels
123 | // There are three delta modes:
124 | // * deltaMode 0 is by pixels, nothing to do
125 | // * deltaMode 1 is by lines
126 | // * deltaMode 2 is by pages
127 | if ( orgEvent.deltaMode === 1 ) {
128 | var lineHeight = $.data(this, 'mousewheel-line-height');
129 | delta *= lineHeight;
130 | deltaY *= lineHeight;
131 | deltaX *= lineHeight;
132 | } else if ( orgEvent.deltaMode === 2 ) {
133 | var pageHeight = $.data(this, 'mousewheel-page-height');
134 | delta *= pageHeight;
135 | deltaY *= pageHeight;
136 | deltaX *= pageHeight;
137 | }
138 |
139 | // Store lowest absolute delta to normalize the delta values
140 | absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
141 |
142 | if ( !lowestDelta || absDelta < lowestDelta ) {
143 | lowestDelta = absDelta;
144 |
145 | // Adjust older deltas if necessary
146 | if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
147 | lowestDelta /= 40;
148 | }
149 | }
150 |
151 | // Adjust older deltas if necessary
152 | if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
153 | // Divide all the things by 40!
154 | delta /= 40;
155 | deltaX /= 40;
156 | deltaY /= 40;
157 | }
158 |
159 | // Get a whole, normalized value for the deltas
160 | delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
161 | deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
162 | deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
163 |
164 | // Add information to the event object
165 | event.deltaX = deltaX;
166 | event.deltaY = deltaY;
167 | event.deltaFactor = lowestDelta;
168 | // Go ahead and set deltaMode to 0 since we converted to pixels
169 | // Although this is a little odd since we overwrite the deltaX/Y
170 | // properties with normalized deltas.
171 | event.deltaMode = 0;
172 |
173 | // Add event and delta to the front of the arguments
174 | args.unshift(event, delta, deltaX, deltaY);
175 |
176 | // Clearout lowestDelta after sometime to better
177 | // handle multiple device types that give different
178 | // a different lowestDelta
179 | // Ex: trackpad = 3 and mouse wheel = 120
180 | if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
181 | nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
182 |
183 | return ($.event.dispatch || $.event.handle).apply(this, args);
184 | }
185 |
186 | function nullLowestDelta() {
187 | lowestDelta = null;
188 | }
189 |
190 | function shouldAdjustOldDeltas(orgEvent, absDelta) {
191 | // If this is an older event and the delta is divisable by 120,
192 | // then we are assuming that the browser is treating this as an
193 | // older mouse wheel event and that we should divide the deltas
194 | // by 40 to try and get a more usable deltaFactor.
195 | // Side note, this actually impacts the reported scroll distance
196 | // in older browsers and can cause scrolling to be slower than native.
197 | // Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
198 | return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
199 | }
200 |
201 | }));
202 |
--------------------------------------------------------------------------------
/doc/js/jquery.smooth-scroll.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function() {
2 | function filterPath(string) {
3 | return string
4 | .replace(/^\//,'')
5 | .replace(/(index|default).[a-zA-Z]{3,4}$/,'')
6 | .replace(/\/$/,'');
7 | }
8 | var locationPath = filterPath(location.pathname);
9 |
10 | $('a[href*=#]').each(function() {
11 | var thisPath = filterPath(this.pathname) || locationPath;
12 | if ( locationPath == thisPath
13 | && (location.hostname == this.hostname || !this.hostname)
14 | && this.hash.replace(/#/,'') ) {
15 | var $target = $(this.hash), target = this.hash;
16 | if (target) {
17 | $(this).click(function(event) {
18 | if (!$(this.hash).offset()) {
19 | return;
20 | }
21 |
22 | event.preventDefault();
23 | position = $(this.hash).offset().top;
24 |
25 | $('html,body').animate({scrollTop: position}, 400, function() {
26 | location.hash = target;
27 | });
28 | });
29 | }
30 | }
31 | });
32 | });
33 |
--------------------------------------------------------------------------------
/doc/phpdoc-cache-2e/phpdoc-cache-settings.dat:
--------------------------------------------------------------------------------
1 | O:51:"phpDocumentor\Descriptor\ProjectDescriptor\Settings":3:{s:13:" * isModified";b:0;s:13:" * visibility";i:7;s:16:" * includeSource";b:0;}
--------------------------------------------------------------------------------
/doc/phpdoc-cache-55/phpdoc-cache-file_768478c531742d2f7b82584b600ec1e4.dat:
--------------------------------------------------------------------------------
1 | O:39:"phpDocumentor\Descriptor\FileDescriptor":22:{s:7:" * hash";s:32:"ad98948ed90787c32c7b804f5c0c493f";s:7:" * path";s:27:"Vertex/UndirectedVertex.php";s:9:" * source";N;s:19:" * namespaceAliases";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * includes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * functions";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * classes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:32:"\GraphDS\Vertex\UndirectedVertex";O:40:"phpDocumentor\Descriptor\ClassDescriptor":19:{s:9:" * parent";s:22:"\GraphDS\Vertex\Vertex";s:13:" * implements";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * abstract";b:0;s:8:" * final";b:0;s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:13:" * properties";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * methods";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:4:{s:11:"addNeighbor";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:" * parent";r:15;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:7:"$vertex";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":16:{s:9:" * method";r:27;s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:" * default";N;s:14:" * byReference";b:0;s:13:" * isVariadic";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:7:"$vertex";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:12:"ID of vertex";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:8:" * fqsen";s:47:"\GraphDS\Vertex\UndirectedVertex::addNeighbor()";s:7:" * name";s:11:"addNeighbor";s:12:" * namespace";s:15:"\GraphDS\Vertex";s:10:" * package";s:0:"";s:10:" * summary";s:53:"Adds a neighboring, undirected vertex to this vertex.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:17;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:" * variableName";s:7:"$vertex";s:8:" * types";r:37;s:7:" * name";s:5:"param";s:14:" * description";s:12:"ID of vertex";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:14:"removeNeighbor";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:" * parent";r:15;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:7:"$vertex";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":16:{s:9:" * method";r:80;s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:" * default";N;s:14:" * byReference";b:0;s:13:" * isVariadic";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:7:"$vertex";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:12:"ID of vertex";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:8:" * fqsen";s:50:"\GraphDS\Vertex\UndirectedVertex::removeNeighbor()";s:7:" * name";s:14:"removeNeighbor";s:12:" * namespace";s:15:"\GraphDS\Vertex";s:10:" * package";s:0:"";s:10:" * summary";s:58:"Removes a neighboring, undirected vertex from this vertex.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:27;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:" * variableName";s:7:"$vertex";s:8:" * types";r:90;s:7:" * name";s:5:"param";s:14:" * description";s:12:"ID of vertex";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:12:"getNeighbors";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:" * parent";r:15;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:48:"\GraphDS\Vertex\UndirectedVertex::getNeighbors()";s:7:" * name";s:12:"getNeighbors";s:12:" * namespace";s:15:"\GraphDS\Vertex";s:10:" * package";s:0:"";s:10:" * summary";s:60:"Returns an array of all neighboring vertices of this vertex.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:39;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:" * name";s:5:"array";}}}s:7:" * name";s:6:"return";s:14:" * description";s:48:"Array of all neighboring vertices of this vertex";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:8:"adjacent";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:" * parent";r:15;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:7:"$vertex";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":16:{s:9:" * method";r:167;s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:" * default";N;s:14:" * byReference";b:0;s:13:" * isVariadic";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:7:"$vertex";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:12:"ID of vertex";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:8:" * fqsen";s:44:"\GraphDS\Vertex\UndirectedVertex::adjacent()";s:7:" * name";s:8:"adjacent";s:12:" * namespace";s:15:"\GraphDS\Vertex";s:10:" * package";s:0:"";s:10:" * summary";s:52:"Checks if a given vertex is adjacent to this vertex.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:51;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:" * variableName";s:7:"$vertex";s:8:" * types";r:177;s:7:" * name";s:5:"param";s:14:" * description";s:12:"ID of vertex";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:47:"phpDocumentor\Descriptor\Type\BooleanDescriptor":0:{}}}s:7:" * name";s:6:"return";s:14:" * description";s:47:"Whether given vertex is adjacent to this vertex";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:13:" * usedTraits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:32:"\GraphDS\Vertex\UndirectedVertex";s:7:" * name";s:16:"UndirectedVertex";s:12:" * namespace";s:15:"\GraphDS\Vertex";s:10:" * package";s:0:"";s:10:" * summary";s:43:"Class defining an undirected vertex object.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";r:1;s:7:" * line";i:10;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"package";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:" * name";s:7:"package";s:14:" * description";s:7:"Default";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:13:" * interfaces";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * traits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * markers";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:0:"";s:7:" * name";s:20:"UndirectedVertex.php";s:12:" * namespace";N;s:10:" * package";s:7:"Default";s:10:" * summary";s:18:"Undirected vertex.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"package";r:240;s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}
--------------------------------------------------------------------------------
/doc/phpdoc-cache-80/phpdoc-cache-file_8277e801acc317dc028b213f4986cf93.dat:
--------------------------------------------------------------------------------
1 | O:39:"phpDocumentor\Descriptor\FileDescriptor":22:{s:7:" * hash";s:32:"b5492025f3c0d3a41c0297fd80952bf4";s:7:" * path";s:21:"Edge/DirectedEdge.php";s:9:" * source";N;s:19:" * namespaceAliases";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * includes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * functions";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * classes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:26:"\GraphDS\Edge\DirectedEdge";O:40:"phpDocumentor\Descriptor\ClassDescriptor":19:{s:9:" * parent";s:18:"\GraphDS\Edge\Edge";s:13:" * implements";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * abstract";b:0;s:8:" * final";b:0;s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:13:" * properties";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * methods";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:11:"__construct";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:" * parent";r:15;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:3:{s:8:"$vertex1";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":16:{s:9:" * method";r:27;s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:" * default";N;s:14:" * byReference";b:0;s:13:" * isVariadic";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:8:"$vertex1";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:18:"ID of first vertex";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:8:"$vertex2";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":16:{s:9:" * method";r:27;s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:" * default";N;s:14:" * byReference";b:0;s:13:" * isVariadic";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:8:"$vertex2";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:19:"ID of second vertex";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:6:"$value";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":16:{s:9:" * method";r:27;s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Type\FloatDescriptor":0:{}}}s:10:" * default";s:4:"null";s:14:" * byReference";b:0;s:13:" * isVariadic";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:6:"$value";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:37:"The value/weight the edge should hold";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:8:" * fqsen";s:41:"\GraphDS\Edge\DirectedEdge::__construct()";s:7:" * name";s:11:"__construct";s:12:" * namespace";s:13:"\GraphDS\Edge";s:10:" * package";s:0:"";s:10:" * summary";s:36:"Constructor for DirectedEdge object.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:20;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:3:{i:0;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:" * variableName";s:8:"$vertex1";s:8:" * types";r:37;s:7:" * name";s:5:"param";s:14:" * description";s:18:"ID of first vertex";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}i:1;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:" * variableName";s:8:"$vertex2";s:8:" * types";r:58;s:7:" * name";s:5:"param";s:14:" * description";s:19:"ID of second vertex";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}i:2;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:" * variableName";s:6:"$value";s:8:" * types";r:79;s:7:" * name";s:5:"param";s:14:" * description";s:37:"The value/weight the edge should hold";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:13:" * usedTraits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:26:"\GraphDS\Edge\DirectedEdge";s:7:" * name";s:12:"DirectedEdge";s:12:" * namespace";s:13:"\GraphDS\Edge";s:10:" * package";s:0:"";s:10:" * summary";s:38:"Class defining a directed edge object.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";r:1;s:7:" * line";i:10;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"package";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:" * name";s:7:"package";s:14:" * description";s:7:"Default";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:13:" * interfaces";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * traits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * markers";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:0:"";s:7:" * name";s:16:"DirectedEdge.php";s:12:" * namespace";N;s:10:" * package";s:7:"Default";s:10:" * summary";s:14:"Directed edge.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"package";r:148;s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}
--------------------------------------------------------------------------------
/doc/phpdoc-cache-a3/phpdoc-cache-file_40f3db65d58a777c567b6c1a9b30878b.dat:
--------------------------------------------------------------------------------
1 | O:39:"phpDocumentor\Descriptor\FileDescriptor":22:{s:7:" * hash";s:32:"db7d26fbb1fb0ac283e8791595ba85cf";s:7:" * path";s:17:"Vertex/Vertex.php";s:9:" * source";N;s:19:" * namespaceAliases";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * includes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * functions";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * classes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:22:"\GraphDS\Vertex\Vertex";O:40:"phpDocumentor\Descriptor\ClassDescriptor":19:{s:9:" * parent";s:0:"";s:13:" * implements";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * abstract";b:0;s:8:" * final";b:0;s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:13:" * properties";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:5:"value";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":16:{s:9:" * parent";r:15;s:8:" * types";N;s:10:" * default";N;s:9:" * static";b:0;s:13:" * visibility";s:9:"protected";s:8:" * fqsen";s:30:"\GraphDS\Vertex\Vertex::$value";s:7:" * name";s:5:"value";s:12:" * namespace";s:15:"\GraphDS\Vertex";s:10:" * package";s:0:"";s:10:" * summary";s:42:"Variable holding the value of this vertex.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:17;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:3:"var";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:42:"phpDocumentor\Descriptor\Tag\VarDescriptor":5:{s:15:" * variableName";s:0:"";s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:" * name";s:5:"mixed";}}}s:7:" * name";s:3:"var";s:14:" * description";s:0:"";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:9:"neighbors";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":16:{s:9:" * parent";r:15;s:8:" * types";N;s:10:" * default";N;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:8:" * fqsen";s:34:"\GraphDS\Vertex\Vertex::$neighbors";s:7:" * name";s:9:"neighbors";s:12:" * namespace";s:15:"\GraphDS\Vertex";s:10:" * package";s:0:"";s:10:" * summary";s:68:"Array holding references to all neighboring vertices of this vertex.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:23;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:3:"var";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:42:"phpDocumentor\Descriptor\Tag\VarDescriptor":5:{s:15:" * variableName";s:0:"";s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:" * name";s:5:"array";}}}s:7:" * name";s:3:"var";s:14:" * description";s:0:"";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:10:" * methods";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:3:{s:11:"__construct";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:" * parent";r:15;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:37:"\GraphDS\Vertex\Vertex::__construct()";s:7:" * name";s:11:"__construct";s:12:" * namespace";s:15:"\GraphDS\Vertex";s:10:" * package";s:0:"";s:10:" * summary";s:38:"Constructor for general Vertex object.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:28;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:8:"getValue";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:" * parent";r:15;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:34:"\GraphDS\Vertex\Vertex::getValue()";s:7:" * name";s:8:"getValue";s:12:" * namespace";s:15:"\GraphDS\Vertex";s:10:" * package";s:0:"";s:10:" * summary";s:43:"Gets the value associated with this vertex.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:39;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:" * name";s:5:"mixed";}}}s:7:" * name";s:6:"return";s:14:" * description";s:33:"Value associated with this vertex";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:8:"setValue";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:" * parent";r:15;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:6:"$value";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":16:{s:9:" * method";r:148;s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:" * name";s:5:"mixed";}}}s:10:" * default";s:4:"null";s:14:" * byReference";b:0;s:13:" * isVariadic";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:6:"$value";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:39:"Value to be associated with this vertex";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:8:" * fqsen";s:34:"\GraphDS\Vertex\Vertex::setValue()";s:7:" * name";s:8:"setValue";s:12:" * namespace";s:15:"\GraphDS\Vertex";s:10:" * package";s:0:"";s:10:" * summary";s:43:"Sets the value associated with this vertex.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:49;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:" * variableName";s:6:"$value";s:8:" * types";r:158;s:7:" * name";s:5:"param";s:14:" * description";s:39:"Value to be associated with this vertex";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:13:" * usedTraits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:22:"\GraphDS\Vertex\Vertex";s:7:" * name";s:6:"Vertex";s:12:" * namespace";s:15:"\GraphDS\Vertex";s:10:" * package";s:0:"";s:10:" * summary";s:51:"Class defining a generic, extendable vertex object.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";r:1;s:7:" * line";i:10;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"package";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:" * name";s:7:"package";s:14:" * description";s:7:"Default";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:13:" * interfaces";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * traits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * markers";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:0:"";s:7:" * name";s:10:"Vertex.php";s:12:" * namespace";N;s:10:" * package";s:7:"Default";s:10:" * summary";s:7:"Vertex.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"package";r:214;s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}
--------------------------------------------------------------------------------
/doc/phpdoc-cache-ab/phpdoc-cache-file_560151d14511e08d19af110deb82b0f5.dat:
--------------------------------------------------------------------------------
1 | O:39:"phpDocumentor\Descriptor\FileDescriptor":22:{s:7:" * hash";s:32:"9598cd9c62d63b4e524c8a27a0138bbb";s:7:" * path";s:15:"Graph/Graph.php";s:9:" * source";N;s:19:" * namespaceAliases";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * includes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * functions";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * classes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:20:"\GraphDS\Graph\Graph";O:40:"phpDocumentor\Descriptor\ClassDescriptor":19:{s:9:" * parent";s:0:"";s:13:" * implements";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * abstract";b:0;s:8:" * final";b:0;s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:13:" * properties";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:3:{s:8:"vertices";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":16:{s:9:" * parent";r:15;s:8:" * types";N;s:10:" * default";N;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:8:" * fqsen";s:31:"\GraphDS\Graph\Graph::$vertices";s:7:" * name";s:8:"vertices";s:12:" * namespace";s:14:"\GraphDS\Graph";s:10:" * package";s:0:"";s:10:" * summary";s:43:"An array holding all vertices of the graph.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:17;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:3:"var";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:42:"phpDocumentor\Descriptor\Tag\VarDescriptor":5:{s:15:" * variableName";s:0:"";s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:" * name";s:5:"array";}}}s:7:" * name";s:3:"var";s:14:" * description";s:0:"";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:5:"edges";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":16:{s:9:" * parent";r:15;s:8:" * types";N;s:10:" * default";N;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:8:" * fqsen";s:28:"\GraphDS\Graph\Graph::$edges";s:7:" * name";s:5:"edges";s:12:" * namespace";s:14:"\GraphDS\Graph";s:10:" * package";s:0:"";s:10:" * summary";s:40:"An array holding all edges of the graph.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:23;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:3:"var";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:42:"phpDocumentor\Descriptor\Tag\VarDescriptor":5:{s:15:" * variableName";s:0:"";s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:" * name";s:5:"array";}}}s:7:" * name";s:3:"var";s:14:" * description";s:0:"";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:8:"directed";O:43:"phpDocumentor\Descriptor\PropertyDescriptor":16:{s:9:" * parent";r:15;s:8:" * types";N;s:10:" * default";N;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:8:" * fqsen";s:31:"\GraphDS\Graph\Graph::$directed";s:7:" * name";s:8:"directed";s:12:" * namespace";s:14:"\GraphDS\Graph";s:10:" * package";s:0:"";s:10:" * summary";s:45:"Defines whether the graph is directed or not.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:29;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:3:"var";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:42:"phpDocumentor\Descriptor\Tag\VarDescriptor":5:{s:15:" * variableName";s:0:"";s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:47:"phpDocumentor\Descriptor\Type\BooleanDescriptor":0:{}}}s:7:" * name";s:3:"var";s:14:" * description";s:0:"";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:10:" * methods";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:3:{s:11:"__construct";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:" * parent";r:15;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:35:"\GraphDS\Graph\Graph::__construct()";s:7:" * name";s:11:"__construct";s:12:" * namespace";s:14:"\GraphDS\Graph";s:10:" * package";s:0:"";s:10:" * summary";s:37:"Constructor for general Graph object.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:34;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:14:"getVertexCount";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:" * parent";r:15;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:38:"\GraphDS\Graph\Graph::getVertexCount()";s:7:" * name";s:14:"getVertexCount";s:12:" * namespace";s:14:"\GraphDS\Graph";s:10:" * package";s:0:"";s:10:" * summary";s:44:"Returns the number of vertices in the graph.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:45;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:47:"phpDocumentor\Descriptor\Type\IntegerDescriptor":0:{}}}s:7:" * name";s:6:"return";s:14:" * description";s:31:"Number of vertices in the graph";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:12:"getEdgeCount";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:" * parent";r:15;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:36:"\GraphDS\Graph\Graph::getEdgeCount()";s:7:" * name";s:12:"getEdgeCount";s:12:" * namespace";s:14:"\GraphDS\Graph";s:10:" * package";s:0:"";s:10:" * summary";s:41:"Returns the number of edges in the graph.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:55;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:47:"phpDocumentor\Descriptor\Type\IntegerDescriptor":0:{}}}s:7:" * name";s:6:"return";s:14:" * description";s:28:"Number of edges in the graph";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:13:" * usedTraits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:20:"\GraphDS\Graph\Graph";s:7:" * name";s:5:"Graph";s:12:" * namespace";s:14:"\GraphDS\Graph";s:10:" * package";s:0:"";s:10:" * summary";s:50:"Class defining a generic, extendable graph object.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";r:1;s:7:" * line";i:10;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"package";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:" * name";s:7:"package";s:14:" * description";s:7:"Default";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:13:" * interfaces";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * traits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * markers";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:0:"";s:7:" * name";s:9:"Graph.php";s:12:" * namespace";N;s:10:" * package";s:7:"Default";s:10:" * summary";s:6:"Graph.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"package";r:222;s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}
--------------------------------------------------------------------------------
/doc/phpdoc-cache-c0/phpdoc-cache-file_401c95ca425ba0e1468e9c1d9fd054c9.dat:
--------------------------------------------------------------------------------
1 | O:39:"phpDocumentor\Descriptor\FileDescriptor":22:{s:7:" * hash";s:32:"23bf042642a72c789b20a123d97fe82a";s:7:" * path";s:27:"Persistence/ImportGraph.php";s:9:" * source";N;s:19:" * namespaceAliases";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:5:{s:5:"Graph";s:20:"\GraphDS\Graph\Graph";s:24:"InvalidArgumentException";s:25:"\InvalidArgumentException";s:16:"SimpleXMLElement";s:17:"\SimpleXMLElement";s:15:"UndirectedGraph";s:30:"\GraphDS\Graph\UndirectedGraph";s:13:"DirectedGraph";s:28:"\GraphDS\Graph\DirectedGraph";}}s:11:" * includes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * functions";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * classes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:32:"\GraphDS\Persistence\ImportGraph";O:40:"phpDocumentor\Descriptor\ClassDescriptor":19:{s:9:" * parent";s:0:"";s:13:" * implements";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * abstract";b:0;s:8:" * final";b:0;s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:13:" * properties";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * methods";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:11:"__construct";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:" * parent";r:20;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:47:"\GraphDS\Persistence\ImportGraph::__construct()";s:7:" * name";s:11:"__construct";s:12:" * namespace";s:20:"\GraphDS\Persistence";s:10:" * package";s:0:"";s:10:" * summary";s:35:"Constructor for the graph importer.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:23;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:11:"fromGraphML";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:" * parent";r:20;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:5:"$file";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":16:{s:9:" * method";r:57;s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:" * default";N;s:14:" * byReference";b:0;s:13:" * isVariadic";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:5:"$file";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:34:"File containing the GraphML markup";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:8:" * fqsen";s:47:"\GraphDS\Persistence\ImportGraph::fromGraphML()";s:7:" * name";s:11:"fromGraphML";s:12:" * namespace";s:20:"\GraphDS\Persistence";s:10:" * package";s:0:"";s:10:" * summary";s:45:"Returns GraphDS graph represented by GraphML.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:34;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:" * variableName";s:5:"$file";s:8:" * types";r:67;s:7:" * name";s:5:"param";s:14:" * description";s:34:"File containing the GraphML markup";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Tag\ReturnDescriptor":4:{s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:51:"phpDocumentor\Descriptor\Type\UnknownTypeDescriptor":1:{s:7:" * name";s:20:"\GraphDS\Graph\Graph";}}}s:7:" * name";s:6:"return";s:14:" * description";s:40:"The graph reconstructed from the GraphML";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:13:" * usedTraits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:32:"\GraphDS\Persistence\ImportGraph";s:7:" * name";s:11:"ImportGraph";s:12:" * namespace";s:20:"\GraphDS\Persistence";s:10:" * package";s:0:"";s:10:" * summary";s:42:"Class defining the graph importer methods.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";r:1;s:7:" * line";i:16;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"package";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:" * name";s:7:"package";s:14:" * description";s:7:"Default";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:13:" * interfaces";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * traits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * markers";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:0:"";s:7:" * name";s:15:"ImportGraph.php";s:12:" * namespace";N;s:10:" * package";s:7:"Default";s:10:" * summary";s:27:"The GraphDS graph importer.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"package";r:131;s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}
--------------------------------------------------------------------------------
/doc/phpdoc-cache-d3/phpdoc-cache-file_546caeef9ab4d3a897a0cc8bd72d02c1.dat:
--------------------------------------------------------------------------------
1 | O:39:"phpDocumentor\Descriptor\FileDescriptor":22:{s:7:" * hash";s:32:"15904a5c411605bc29cc3ef7ae25da3b";s:7:" * path";s:23:"Edge/UndirectedEdge.php";s:9:" * source";N;s:19:" * namespaceAliases";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * includes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:12:" * functions";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * classes";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:28:"\GraphDS\Edge\UndirectedEdge";O:40:"phpDocumentor\Descriptor\ClassDescriptor":19:{s:9:" * parent";s:18:"\GraphDS\Edge\Edge";s:13:" * implements";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:11:" * abstract";b:0;s:8:" * final";b:0;s:12:" * constants";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:13:" * properties";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * methods";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{s:11:"__construct";O:41:"phpDocumentor\Descriptor\MethodDescriptor":17:{s:9:" * parent";r:15;s:11:" * abstract";b:0;s:8:" * final";b:0;s:9:" * static";b:0;s:13:" * visibility";s:6:"public";s:12:" * arguments";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:3:{s:8:"$vertex1";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":16:{s:9:" * method";r:27;s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:" * default";N;s:14:" * byReference";b:0;s:13:" * isVariadic";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:8:"$vertex1";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:18:"ID of first vertex";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:8:"$vertex2";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":16:{s:9:" * method";r:27;s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:46:"phpDocumentor\Descriptor\Type\StringDescriptor":0:{}}}s:10:" * default";N;s:14:" * byReference";b:0;s:13:" * isVariadic";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:8:"$vertex2";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:19:"ID of second vertex";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}s:6:"$value";O:43:"phpDocumentor\Descriptor\ArgumentDescriptor":16:{s:9:" * method";r:27;s:8:" * types";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:45:"phpDocumentor\Descriptor\Type\FloatDescriptor":0:{}}}s:10:" * default";s:4:"null";s:14:" * byReference";b:0;s:13:" * isVariadic";b:0;s:8:" * fqsen";s:0:"";s:7:" * name";s:6:"$value";s:12:" * namespace";N;s:10:" * package";s:0:"";s:10:" * summary";s:0:"";s:14:" * description";s:37:"The value/weight the edge should hold";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:8:" * fqsen";s:43:"\GraphDS\Edge\UndirectedEdge::__construct()";s:7:" * name";s:11:"__construct";s:12:" * namespace";s:13:"\GraphDS\Edge";s:10:" * package";s:0:"";s:10:" * summary";s:38:"Constructor for UndirectedEdge object.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:20;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:5:"param";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:3:{i:0;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:" * variableName";s:8:"$vertex1";s:8:" * types";r:37;s:7:" * name";s:5:"param";s:14:" * description";s:18:"ID of first vertex";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}i:1;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:" * variableName";s:8:"$vertex2";s:8:" * types";r:58;s:7:" * name";s:5:"param";s:14:" * description";s:19:"ID of second vertex";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}i:2;O:44:"phpDocumentor\Descriptor\Tag\ParamDescriptor":5:{s:15:" * variableName";s:6:"$value";s:8:" * types";r:79;s:7:" * name";s:5:"param";s:14:" * description";s:37:"The value/weight the edge should hold";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:6:"return";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:13:" * usedTraits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:28:"\GraphDS\Edge\UndirectedEdge";s:7:" * name";s:14:"UndirectedEdge";s:12:" * namespace";s:13:"\GraphDS\Edge";s:10:" * package";s:0:"";s:10:" * summary";s:41:"Class defining an undirected edge object.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";r:1;s:7:" * line";i:11;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"package";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:1:{i:0;O:38:"phpDocumentor\Descriptor\TagDescriptor":3:{s:7:" * name";s:7:"package";s:14:" * description";s:7:"Default";s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}}s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}}}s:13:" * interfaces";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:9:" * traits";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:10:" * markers";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:8:" * fqsen";s:0:"";s:7:" * name";s:18:"UndirectedEdge.php";s:12:" * namespace";N;s:10:" * package";s:7:"Default";s:10:" * summary";s:16:"Undirected edge.";s:14:" * description";s:0:"";s:17:" * fileDescriptor";N;s:7:" * line";i:0;s:7:" * tags";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:2:{s:7:"package";r:148;s:10:"subpackage";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}}}s:9:" * errors";O:35:"phpDocumentor\Descriptor\Collection":1:{s:8:" * items";a:0:{}}s:19:" * inheritedElement";N;}
--------------------------------------------------------------------------------
/graphDirected.graphml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | 20
20 |
21 |
22 | 80
23 |
24 |
25 | 90
26 |
27 |
28 | 10
29 |
30 |
31 | 10
32 |
33 |
34 | 50
35 |
36 |
37 | 20
38 |
39 |
40 | 20
41 |
42 |
43 | 50
44 |
45 |
46 | 30
47 |
48 |
49 | 40
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/graphUndirected.graphml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | 20
15 |
16 |
17 | 80
18 |
19 |
20 | 90
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
13 | ./tests
14 |
15 |
16 |
17 |
18 | ./src
19 |
20 | ./vendor
21 | ./doc
22 | ./SampleApp_RoadPlanner/
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/Algo/BFS.php:
--------------------------------------------------------------------------------
1 | graph = &$graph;
60 | $this->dist = array();
61 | $this->parent = array();
62 | $this->discovered = array();
63 | }
64 |
65 | /**
66 | * Runs the BFS from a given vertex $vertex on the graph.
67 | *
68 | * @param mixed $root ID of the vertex from which the BFS should begin
69 | */
70 | public function run($root)
71 | {
72 | foreach (array_keys($this->graph->vertices) as $vertex) {
73 | $this->dist[$vertex] = INF;
74 | $this->parent[$vertex] = null;
75 | }
76 |
77 | $this->discovered = array();
78 |
79 | $queue = new SplQueue();
80 |
81 | $this->dist[$root] = 0;
82 | $queue->enqueue($root);
83 |
84 | while (!$queue->isEmpty()) {
85 | $this->discovered[] = $current = $queue->dequeue();
86 |
87 | if ($this->graph instanceof UndirectedGraph) {
88 | $neighbors = $this->graph->vertices[$current]->getNeighbors();
89 | } elseif ($this->graph instanceof DirectedGraph) {
90 | $neighbors = $this->graph->vertices[$current]->getOutNeighbors();
91 | }
92 |
93 | foreach ($neighbors as $vertex) {
94 | if ($this->dist[$vertex] == INF) {
95 | $this->dist[$vertex] = $this->dist[$current] + 1;
96 | $this->parent[$vertex] = $current;
97 | $queue->enqueue($vertex);
98 | }
99 | }
100 | }
101 | }
102 |
103 | /**
104 | * Returns the result of the BFS.
105 | *
106 | * @return array Array of vertex distance to root, parents and vertices in BFS order
107 | */
108 | public function get()
109 | {
110 | return array(
111 | 'dist' => $this->dist,
112 | 'parent' => $this->parent,
113 | 'discovered' => $this->discovered,
114 | );
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/src/Algo/DFS.php:
--------------------------------------------------------------------------------
1 | graph = &$graph;
60 | $this->discovered = array();
61 | }
62 |
63 | /**
64 | * Runs the DFS from a given vertex $vertex on the graph.
65 | *
66 | * @param mixed $root ID of the vertex from which the DFS should begin
67 | */
68 | public function run($root)
69 | {
70 | foreach (array_keys($this->graph->vertices) as $vertex) {
71 | $this->dist[$vertex] = INF;
72 | $this->parent[$vertex] = null;
73 | }
74 |
75 | $this->discovered = array();
76 |
77 | $stack = new SplStack();
78 |
79 | $this->dist[$root] = 0;
80 | $stack->push($root);
81 |
82 | while (!$stack->isEmpty()) {
83 | $current = $stack->pop();
84 | if (!in_array($current, $this->discovered)) {
85 | $this->discovered[] = $current;
86 |
87 | if ($this->graph instanceof UndirectedGraph) {
88 | $neighbors = $this->graph->vertices[$current]->getNeighbors();
89 | } elseif ($this->graph instanceof DirectedGraph) {
90 | $neighbors = $this->graph->vertices[$current]->getOutNeighbors();
91 | }
92 |
93 | foreach ($neighbors as $vertex) {
94 | if ($this->dist[$vertex] == INF) {
95 | $this->dist[$vertex] = $this->dist[$current] + 1;
96 | $this->parent[$vertex] = $current;
97 | $stack->push($vertex);
98 | }
99 | }
100 | }
101 | }
102 | }
103 |
104 | /**
105 | * Returns the result of the DFS.
106 | *
107 | * @return array Array of vertex distance to root, parents and vertices in DFS order
108 | */
109 | public function get()
110 | {
111 | return array(
112 | 'dist' => $this->dist,
113 | 'parent' => $this->parent,
114 | 'discovered' => $this->discovered,
115 | );
116 | }
117 | }
118 |
--------------------------------------------------------------------------------
/src/Algo/Dijkstra.php:
--------------------------------------------------------------------------------
1 | graph = &$graph;
68 | }
69 |
70 | /**
71 | * Calculates the shortest path to every vertex from vertex $start.
72 | *
73 | * @param mixed $start ID of the starting vertex for Dijkstra's algorithm
74 | *
75 | * @throws InvalidArgumentException
76 | */
77 | public function run($start)
78 | {
79 | $this->start = $start;
80 | if (empty($this->graph->vertices[$start])) {
81 | throw new InvalidArgumentException("Vertex $start does not exist.");
82 | }
83 | foreach (array_keys($this->graph->vertices) as $vertex) {
84 | $this->dist[$vertex] = INF;
85 | $this->prev[$vertex] = null;
86 | $this->unvisitedVertices[$vertex] = null;
87 | }
88 |
89 | $this->dist[$start] = 0;
90 |
91 | while (count($this->unvisitedVertices) > 0) {
92 | $distUnvisited = array_intersect_key($this->dist, $this->unvisitedVertices);
93 | $minVertexTmp = array_keys($distUnvisited, min($distUnvisited));
94 | $minVertex = $minVertexTmp[0];
95 | unset($this->unvisitedVertices[$minVertex]);
96 |
97 | if ($this->graph instanceof UndirectedGraph) {
98 | $neighbors = $this->graph->vertices[$minVertex]->getNeighbors();
99 | } elseif ($this->graph instanceof DirectedGraph) {
100 | $neighbors = $this->graph->vertices[$minVertex]->getOutNeighbors();
101 | } else {
102 | throw new InvalidArgumentException("The provided graph is neither an undirected graph or a directed graph");
103 | }
104 |
105 | foreach ($neighbors as $vertex) {
106 | $alt = $this->dist[$minVertex] + $this->graph->edge($minVertex, $vertex)->getValue();
107 | if ($alt < $this->dist[$vertex]) {
108 | $this->dist[$vertex] = $alt;
109 | $this->prev[$vertex] = $minVertex;
110 | }
111 | }
112 | }
113 | }
114 |
115 | /**
116 | * Returns the shortest path to $destinationVertex from the origin vertex in the graph.
117 | *
118 | * @param mixed $destinationVertex ID of the destination vertex
119 | *
120 | * @return array An array containing the shortest path and distance
121 | */
122 | public function get($destinationVertex)
123 | {
124 | $originalDestinationVertex = $destinationVertex;
125 |
126 | $path = array();
127 |
128 | while (isset($this->prev[$destinationVertex])) {
129 | array_unshift($path, $destinationVertex);
130 | $destinationVertex = $this->prev[$destinationVertex];
131 | }
132 |
133 | if ($destinationVertex === $this->start) {
134 | array_unshift($path, $destinationVertex);
135 | }
136 |
137 | return array(
138 | 'path' => $path,
139 | 'dist' => $this->dist[$originalDestinationVertex],
140 | );
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/src/Algo/DijkstraMulti.php:
--------------------------------------------------------------------------------
1 | graph = &$graph;
80 | }
81 |
82 | /**
83 | * Calculates the shortest path to every vertex from vertex $start.
84 | *
85 | * @param mixed $start ID of the starting vertex for multi-path Dijkstra's algorithm
86 | *
87 | * @return array Array holding the distances and previous vertices as calculated by Dijkstra's algorithm
88 | *
89 | * @throws InvalidArgumentException
90 | */
91 | public function run($start)
92 | {
93 | $this->start = $start;
94 | if (empty($this->graph->vertices[$start])) {
95 | throw new InvalidArgumentException("Vertex $start does not exist.");
96 | }
97 | foreach (array_keys($this->graph->vertices) as $vertex) {
98 | $this->dist[$vertex] = INF;
99 | $this->prev[$vertex] = null;
100 | $this->unvisitedVertices[$vertex] = null;
101 | }
102 |
103 | $this->dist[$start] = 0;
104 |
105 | while (count($this->unvisitedVertices) > 0) {
106 | $distUnvisited = array_intersect_key($this->dist, $this->unvisitedVertices);
107 | $minVertexTmp = array_keys($distUnvisited, min($distUnvisited));
108 | $minVertex = $minVertexTmp[0];
109 | unset($this->unvisitedVertices[$minVertex]);
110 |
111 | if ($this->graph instanceof UndirectedGraph) {
112 | $neighbors = $this->graph->vertices[$minVertex]->getNeighbors();
113 | } elseif ($this->graph instanceof DirectedGraph) {
114 | $neighbors = $this->graph->vertices[$minVertex]->getOutNeighbors();
115 | }
116 |
117 | foreach ($neighbors as $vertex) {
118 | $alt = $this->dist[$minVertex] + $this->graph->edge($minVertex, $vertex)->getValue();
119 | if ($alt < $this->dist[$vertex]) {
120 | $this->dist[$vertex] = $alt;
121 | $this->prev[$vertex] = null;
122 | $this->prev[$vertex][] = $minVertex;
123 | } elseif ($alt === $this->dist[$vertex]) {
124 | $this->prev[$vertex][] = $minVertex;
125 | }
126 | }
127 | }
128 |
129 | return $this->prev;
130 | }
131 |
132 | /**
133 | * Returns all shortest paths to $dest from the origin vertex $this->start in the graph.
134 | *
135 | * @param string $dest ID of the destination vertex
136 | *
137 | * @return array An array containing the shortest path and distance
138 | */
139 | public function get($dest)
140 | {
141 | $this->paths = array();
142 | $this->enumerate($dest, $this->start);
143 |
144 | return array(
145 | 'paths' => $this->paths,
146 | 'dist' => $this->dist[$dest],
147 | );
148 | }
149 |
150 | /**
151 | * Enumerates the result of the multi-path Dijkstra as paths.
152 | *
153 | * @param mixed $source ID of the source vertex
154 | * @param mixed $dest ID of the destination vertex
155 | */
156 | private function enumerate($source, $dest)
157 | {
158 | array_unshift($this->path, $source);
159 | $discovered[] = $source;
160 |
161 | if ($source === $dest) {
162 | $this->paths[] = $this->path;
163 | } else {
164 | if (!$this->prev[$source]) {
165 | return;
166 | }
167 | foreach ($this->prev[$source] as $child) {
168 | if (!in_array($child, $discovered)) {
169 | $this->enumerate($child, $dest);
170 | }
171 | }
172 | }
173 |
174 | array_shift($this->path);
175 | if (($key = array_search($source, $discovered)) !== false) {
176 | unset($discovered[$key]);
177 | }
178 | }
179 | }
180 |
--------------------------------------------------------------------------------
/src/Algo/FloydWarshall.php:
--------------------------------------------------------------------------------
1 | graph = &$graph;
54 | }
55 |
56 | /**
57 | * Calculates the shortest paths in the graph using the Floyd-Warshall algorithm.
58 | */
59 | public function run()
60 | {
61 | foreach (array_keys($this->graph->vertices) as $vertex1) {
62 | foreach (array_keys($this->graph->vertices) as $vertex2) {
63 | $this->dist[$vertex1][$vertex2] = INF;
64 | $this->next[$vertex1][$vertex2] = null;
65 | $this->dist[$vertex1][$vertex1] = 0;
66 | }
67 | }
68 | foreach ($this->graph->edges as $vertex1 => $vertex1Value) {
69 | foreach ($vertex1Value as $vertex2 => $vertex2Value) {
70 | $this->dist[$vertex1][$vertex2] = $vertex2Value->getValue();
71 | $this->next[$vertex1][$vertex2] = $vertex2;
72 | if ($this->graph instanceof UndirectedGraph) {
73 | $this->dist[$vertex2][$vertex1] = $this->dist[$vertex1][$vertex2];
74 | $this->next[$vertex2][$vertex1] = $vertex1;
75 | }
76 | }
77 | }
78 | foreach (array_keys($this->graph->vertices) as $k) {
79 | foreach (array_keys($this->graph->vertices) as $i) {
80 | foreach (array_keys($this->graph->vertices) as $j) {
81 | if ($this->dist[$i][$j] > ($this->dist[$i][$k] + $this->dist[$k][$j])) {
82 | $this->dist[$i][$j] = $this->dist[$i][$k] + $this->dist[$k][$j];
83 | $this->next[$i][$j] = $this->next[$i][$k];
84 | }
85 | }
86 | }
87 | }
88 | }
89 |
90 | /**
91 | * Returns the shortest path from vertex $start to $dest in the graph.
92 | *
93 | * @param mixed $start ID of the start vertex
94 | * @param mixed $dest ID of the destination vertex
95 | *
96 | * @return array|null An array containing the shortest path and distance
97 | */
98 | public function get($start, $dest)
99 | {
100 | $startReal = $start;
101 | $path = array($start);
102 | while ($start !== $dest) {
103 | if (!($start = $this->next[$start][$dest])) {
104 | return null;
105 | }
106 | $path[] = $start;
107 | }
108 |
109 | return array(
110 | 'path' => $path,
111 | 'dist' => $this->dist[$startReal][$dest],
112 | );
113 | }
114 | }
115 |
--------------------------------------------------------------------------------
/src/Algo/Yen.php:
--------------------------------------------------------------------------------
1 | graph = &$graph;
47 | $this->results = array();
48 | }
49 |
50 | /**
51 | * Calculates the k best paths using Yen's algorithm.
52 | *
53 | * @param mixed $start ID of the start vertex
54 | * @param mixed $dest ID of the destination vertex
55 | * @param integer $k Number of best paths to compute
56 | */
57 | public function run($start, $dest, $k = 3)
58 | {
59 | if (empty($this->graph->vertices[$start])) {
60 | throw new InvalidArgumentException("Vertex $start does not exist.");
61 | }
62 | if (empty($this->graph->vertices[$dest])) {
63 | throw new InvalidArgumentException("Vertex $dest does not exist.");
64 | }
65 | $a = array();
66 | // Determine the shortest path from the start to the dest.
67 | $dm = new Dijkstra($this->graph);
68 | $dm->run($start);
69 | $a[0] = $dm->get($dest);
70 | for ($kIterator = 1; $kIterator < $k; $kIterator++) {
71 | // Initialize the set to store the potential kth shortest path.
72 | $b = array();
73 | // The spur node ranges from the first node to the next to last node in the previous k-shortest path.
74 | for ($i = 0, $iMax = count($a[$kIterator - 1]['path']) - 2; $i <= $iMax; $i++) {
75 | // Deep clone the graph to make sure we do not mutate it.
76 | $graphClone = unserialize(serialize($this->graph));
77 | // Spur node is retrieved from the previous k-shortest path, k − 1.
78 | $spurNode = $a[$kIterator - 1]['path'][$i];
79 | // The sequence of nodes from the start to the spur node of the previous k-shortest path.
80 | $rootPath = array_slice($a[$kIterator - 1]['path'], 0, $i + 1);
81 | // The length of the sequence from the start to the spur node of the previous k-shortest path.
82 | $rootPathLength = 0;
83 | for ($rootPathIterator = 0, $rootPathIteratorMax = count($rootPath) - 2; $rootPathIterator <= $rootPathIteratorMax; $rootPathIterator++) {
84 | $rootPathLength += $graphClone->edge($rootPath[$rootPathIterator], $rootPath[$rootPathIterator + 1])->getValue();
85 | }
86 | foreach ($a as $p) {
87 | if ($rootPath === array_slice($p['path'], 0, $i + 1)) {
88 | // Remove the links that are part of the previous shortest paths which share the same root path.
89 | if (null !== $graphClone->edge($p['path'][$i], $p['path'][$i + 1])) {
90 | $graphClone->removeEdge($p['path'][$i], $p['path'][$i + 1]);
91 | }
92 | }
93 | }
94 | foreach ($rootPath as $rootPathNode) {
95 | if ($rootPathNode !== $spurNode) {
96 | $graphClone->removeVertex($rootPathNode);
97 | }
98 | }
99 | // Calculate the spur path from the spur node to the dest.
100 | $dm = new Dijkstra($graphClone);
101 | $dm->run($spurNode);
102 | $spurPath = $dm->get($dest);
103 | // Entire path is made up of the root path and spur path.
104 | $totalPath = array_merge(array_slice($rootPath, 0, -1), $spurPath['path']);
105 | // Add the potential k-shortest path to the heap.
106 | if (count($spurPath['path']) > 0) {
107 | $b[] = array(
108 | 'path' => $totalPath,
109 | 'dist' => $rootPathLength + $spurPath['dist'],
110 | );
111 | }
112 | }
113 | if (empty($b)) {
114 | // This handles the case of there being no spur paths, or no spur paths left.
115 | // This could happen if the spur paths have already been exhausted (added to A),
116 | // or there are no spur paths at all - such as when both the start and dest vertices
117 | // lie along a "dead end".
118 | break;
119 | }
120 | // Sort the potential k-shortest paths by cost.
121 | usort($b, function ($first, $second) {
122 | return $first['dist'] - $second['dist'];
123 | });
124 | // Add the lowest cost path becomes the k-shortest path.
125 | $a[$kIterator] = $b[0];
126 | }
127 | $this->results = $a;
128 | }
129 |
130 | /**
131 | * Returns the shortest paths as computed.
132 | *
133 | * @return array The shortest paths
134 | */
135 | public function get()
136 | {
137 | return $this->results;
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/src/Edge/DirectedEdge.php:
--------------------------------------------------------------------------------
1 | vertices['from'] = $vertex1;
23 | $this->vertices['to'] = $vertex2;
24 | $this->value = $value;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Edge/Edge.php:
--------------------------------------------------------------------------------
1 | value = null;
32 | $this->vertices = array();
33 | }
34 |
35 | /**
36 | * Returns value/weight associated with this edge.
37 | *
38 | * @return float Value/weight associated with this edge
39 | */
40 | public function getValue()
41 | {
42 | return $this->value;
43 | }
44 |
45 | /**
46 | * Sets the value/weight associated with this edge.
47 | *
48 | * @param float $value Value/weight to be associated with this edge
49 | */
50 | public function setValue($value = null)
51 | {
52 | $this->value = (double) $value;
53 | }
54 |
55 | /**
56 | * Returns an array of vertices connected by this edge.
57 | *
58 | * @return array Vertices connected by this edge
59 | */
60 | public function getConnectedVertices()
61 | {
62 | return $this->vertices;
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/src/Edge/UndirectedEdge.php:
--------------------------------------------------------------------------------
1 | vertices['from'] = $vertex1;
24 | $this->vertices['to'] = $vertex2;
25 | $this->value = $value;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/Graph/DirectedGraph.php:
--------------------------------------------------------------------------------
1 | directed = true;
22 | }
23 |
24 | /**
25 | * Adds a directed vertex to the graph.
26 | *
27 | * @param string $vertex ID of the vertex
28 | */
29 | public function addVertex($vertex)
30 | {
31 | if (empty($this->vertices[$vertex])) {
32 | $this->vertices[$vertex] = new DirectedVertex();
33 | }
34 | }
35 |
36 | /**
37 | * Removes a directed vertex from the graph.
38 | *
39 | * @param string $vertex ID of the vertex
40 | *
41 | * @throws InvalidArgumentException
42 | */
43 | public function removeVertex($vertex)
44 | {
45 | if (empty($this->vertices[$vertex])) {
46 | throw new InvalidArgumentException("Vertex $vertex does not exist.");
47 | }
48 | $neighbors = $this->vertices[$vertex]->getNeighbors();
49 | foreach ($neighbors['out'] as $neighbor) {
50 | if (($key = array_search($vertex, $this->vertices[$neighbor]->getInNeighbors())) !== false) {
51 | unset($this->vertices[$neighbor]->neighbors['in'][$key]);
52 | }
53 | }
54 | foreach ($neighbors['in'] as $neighbor) {
55 | if (($key = array_search($vertex, $this->vertices[$neighbor]->getOutNeighbors())) !== false) {
56 | unset($this->vertices[$neighbor]->neighbors['out'][$key]);
57 | }
58 | if ($this->edge($neighbor, $vertex)) {
59 | $this->removeEdge($neighbor, $vertex);
60 | }
61 | }
62 | unset($this->edges[$vertex], $this->vertices[$vertex]);
63 | }
64 |
65 | /**
66 | * Returns an edge object in the graph from $vertex1 to $vertex2.
67 | *
68 | * @param string $vertex1 ID of first vertex
69 | * @param string $vertex2 ID of second vertex
70 | *
71 | * @return DirectedEdge Instance of DirectedEdge from $vertex1 to $vertex2 and null if none exists
72 | *
73 | * @throws InvalidArgumentException
74 | */
75 | public function edge($vertex1, $vertex2)
76 | {
77 | if (empty($this->vertices[$vertex1]) || empty($this->vertices[$vertex2])) {
78 | throw new InvalidArgumentException('One of the vertices does not exist.');
79 | }
80 | if (isset($this->edges[$vertex1][$vertex2])) {
81 | return $this->edges[$vertex1][$vertex2];
82 | }
83 |
84 | return null;
85 | }
86 |
87 | /**
88 | * Adds a directed edge between two directed vertices ($vertex1 to $vertex2).
89 | *
90 | * @param string $vertex1 ID of first vertex
91 | * @param string $vertex2 ID of second vertex
92 | * @param float $value The value/weight the edge should hold
93 | *
94 | * @throws InvalidArgumentException
95 | */
96 | public function addEdge($vertex1, $vertex2, $value = null)
97 | {
98 | if (empty($this->vertices[$vertex1]) || empty($this->vertices[$vertex2])) {
99 | throw new InvalidArgumentException('One of the vertices does not exist.');
100 | }
101 | if (null === $this->edge($vertex1, $vertex2)) {
102 | $this->edges[$vertex1][$vertex2] = new DirectedEdge($vertex1, $vertex2, $value);
103 | $this->vertices[$vertex1]->addOutNeighbor($vertex2);
104 | $this->vertices[$vertex2]->addInNeighbor($vertex1);
105 | }
106 | }
107 |
108 | /**
109 | * Removes a directed edge between two directed vertices ($vertex1 to $vertex2).
110 | *
111 | * @param string $vertex1 ID of first vertex
112 | * @param string $vertex2 ID of second vertex
113 | *
114 | * @throws InvalidArgumentException
115 | */
116 | public function removeEdge($vertex1, $vertex2)
117 | {
118 | if (empty($this->vertices[$vertex1]) || empty($this->vertices[$vertex2])) {
119 | throw new InvalidArgumentException('One of the vertices does not exist.');
120 | }
121 | if (null === $this->edge($vertex1, $vertex2)) {
122 | throw new InvalidArgumentException("No edge from $vertex1 to $vertex2.");
123 | }
124 | $this->vertices[$vertex1]->removeOutNeighbor($vertex2);
125 | $this->vertices[$vertex2]->removeInNeighbor($vertex1);
126 | unset($this->edges[$vertex1][$vertex2]);
127 | if (empty($this->edges[$vertex1])) {
128 | unset($this->edges[$vertex1]);
129 | }
130 | }
131 |
132 | /**
133 | * Transposes the graph, reversing each directed edge.
134 | *
135 | * @return DirectedGraph The transposed graph
136 | *
137 | * @throws InvalidArgumentException
138 | */
139 | public function getTranspose()
140 | {
141 | $graph = clone $this;
142 |
143 | foreach ($graph->edges as $vertex1 => $vertex1Data) {
144 | foreach ($vertex1Data as $vertex2 => $vertex2Data) {
145 | $value = $graph->edge($vertex1, $vertex2)->getValue();
146 | $graph->removeEdge($vertex1, $vertex2);
147 | $graph->addEdge($vertex2, $vertex1, $value);
148 | }
149 | }
150 |
151 | return $graph;
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/src/Graph/Graph.php:
--------------------------------------------------------------------------------
1 | vertices);
45 | }
46 |
47 | /**
48 | * Returns the number of edges in the graph.
49 | *
50 | * @return int Number of edges in the graph
51 | */
52 | public function getEdgeCount()
53 | {
54 | $count = 0;
55 | foreach ($this->edges as $edgesFrom) {
56 | $count += count($edgesFrom);
57 | }
58 |
59 | return $count;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/Graph/UndirectedGraph.php:
--------------------------------------------------------------------------------
1 | directed = false;
26 | }
27 |
28 | /**
29 | * Adds an undirected vertex to the graph.
30 | *
31 | * @param string $vertex ID of the vertex
32 | */
33 | public function addVertex($vertex)
34 | {
35 | if (empty($this->vertices[$vertex])) {
36 | $this->vertices[$vertex] = new UndirectedVertex();
37 | }
38 | }
39 |
40 | /**
41 | * Removes an undirected vertex from the graph.
42 | *
43 | * @param string $vertex ID of the vertex
44 | *
45 | * @throws InvalidArgumentException
46 | */
47 | public function removeVertex($vertex)
48 | {
49 | if (empty($this->vertices[$vertex])) {
50 | throw new InvalidArgumentException("Vertex $vertex does not exist.");
51 | }
52 | $neighbors = $this->vertices[$vertex]->getNeighbors();
53 | foreach ($neighbors as $neighbor) {
54 | if (($key = array_search($vertex, $this->vertices[$neighbor]->neighbors)) !== false) {
55 | unset($this->vertices[$neighbor]->neighbors[$key]);
56 | }
57 | if ($this->edge($neighbor, $vertex)) {
58 | $this->removeEdge($neighbor, $vertex);
59 | }
60 | }
61 | unset($this->edges[$vertex], $this->vertices[$vertex]);
62 | }
63 |
64 | /**
65 | * Returns an edge object in the graph, regardless of vertex order (undirected).
66 | *
67 | * @param string $vertex1 ID of first vertex
68 | * @param string $vertex2 ID of second vertex
69 | *
70 | * @return UndirectedEdge|null Instance of UndirectedEdge between $vertex1 and $vertex2 or null if no edge exists
71 | *
72 | * @throws InvalidArgumentException
73 | */
74 | public function edge($vertex1, $vertex2)
75 | {
76 | if (empty($this->vertices[$vertex1]) || empty($this->vertices[$vertex2])) {
77 | throw new InvalidArgumentException('One of the vertices does not exist.');
78 | }
79 | if (isset($this->edges[$vertex1][$vertex2])) {
80 | return $this->edges[$vertex1][$vertex2];
81 | } elseif (isset($this->edges[$vertex2][$vertex1])) {
82 | return $this->edges[$vertex2][$vertex1];
83 | }
84 |
85 | return null;
86 | }
87 |
88 | /**
89 | * Adds an undirected edge between two undirected vertices.
90 | *
91 | * @param string $vertex1 ID of first vertex
92 | * @param string $vertex2 ID of second vertex
93 | * @param float $value The value/weight the edge should hold
94 | *
95 | * @throws InvalidArgumentException
96 | */
97 | public function addEdge($vertex1, $vertex2, $value = null)
98 | {
99 | if ($vertex1 === $vertex2) {
100 | throw new InvalidArgumentException('Cannot connect vertex to itself.');
101 | }
102 | if (empty($this->vertices[$vertex1]) || empty($this->vertices[$vertex2])) {
103 | throw new InvalidArgumentException('One of the vertices does not exist.');
104 | }
105 | if (null === $this->edge($vertex1, $vertex2)) {
106 | $this->edges[$vertex1][$vertex2] = new UndirectedEdge($vertex1, $vertex2, $value);
107 | $this->vertices[$vertex1]->addNeighbor($vertex2);
108 | $this->vertices[$vertex2]->addNeighbor($vertex1);
109 | }
110 | }
111 |
112 | /**
113 | * Removes an undirected edge between two undirected vertices.
114 | *
115 | * @param string $vertex1 ID of first undirected vertex
116 | * @param string $vertex2 ID of second undirected vertex
117 | *
118 | * @throws InvalidArgumentException
119 | */
120 | public function removeEdge($vertex1, $vertex2)
121 | {
122 | if (empty($this->vertices[$vertex1]) || empty($this->vertices[$vertex2])) {
123 | throw new InvalidArgumentException('One of the vertices does not exist.');
124 | }
125 | if (null === $this->edge($vertex1, $vertex2)) {
126 | throw new InvalidArgumentException("No edge between $vertex1 and $vertex2.");
127 | }
128 | $this->vertices[$vertex1]->removeNeighbor($vertex2);
129 | $this->vertices[$vertex2]->removeNeighbor($vertex1);
130 | if (isset($this->edges[$vertex1][$vertex2])) {
131 | unset($this->edges[$vertex1][$vertex2]);
132 | if (empty($this->edges[$vertex1])) {
133 | unset($this->edges[$vertex1]);
134 | }
135 | }
136 | if (isset($this->edges[$vertex2][$vertex1])) {
137 | unset($this->edges[$vertex2][$vertex1]);
138 | if (empty($this->edges[$vertex2])) {
139 | unset($this->edges[$vertex2]);
140 | }
141 | }
142 | }
143 | }
144 |
--------------------------------------------------------------------------------
/src/Persistence/ExportGraph.php:
--------------------------------------------------------------------------------
1 | graph = &$graph;
34 | }
35 |
36 | /**
37 | * Returns the GraphML output representing the graph.
38 | *
39 | * @return string
40 | */
41 | public function getGraphML()
42 | {
43 | $directionality = $this->graph->directed ? 'directed' : 'undirected';
44 | $export = new SimpleXMLElement(''
45 | .''
46 | .'');
47 |
48 | $keyNode = $export->addChild('key');
49 | $keyNode->addAttribute('id', 'd0');
50 | $keyNode->addAttribute('for', 'node');
51 | $keyNode->addAttribute('attr.name', 'value');
52 | $keyNode->addAttribute('attr.type', 'string');
53 | $keyNode->addChild('default', '');
54 |
55 | $keyEdge = $export->addChild('key');
56 | $keyEdge->addAttribute('id', 'd1');
57 | $keyEdge->addAttribute('for', 'edge');
58 | $keyEdge->addAttribute('attr.name', 'weight');
59 | $keyEdge->addAttribute('attr.type', 'double');
60 | $keyEdge->addChild('default', '');
61 |
62 | $graphElem = $export->addChild('graph');
63 | $graphElem->addAttribute('id', 'G');
64 | $graphElem->addAttribute('edgedefault', $directionality);
65 | $graphElem->addAttribute('parse.nodes', $this->graph->getVertexCount());
66 | $graphElem->addAttribute('parse.edges', $this->graph->getEdgeCount());
67 | $graphElem->addAttribute('parse.nodeids', 'free');
68 | $graphElem->addAttribute('parse.edgeids', 'free');
69 | $graphElem->addAttribute('parse.order', 'nodesfirst');
70 |
71 | foreach ($this->graph->vertices as $vertexKey => $vertex) {
72 | $node = $graphElem->addChild('node');
73 | $node->addAttribute('id', $vertexKey);
74 | if (null !== ($value = $vertex->getValue())) {
75 | $data = $node->addChild('data', $value);
76 | $data->addAttribute('key', 'd0');
77 | }
78 | }
79 | foreach ($this->graph->edges as $edgeSource) {
80 | foreach ($edgeSource as $edgeTarget) {
81 | $edge = $graphElem->addChild('edge');
82 | $edge->addAttribute('source', $edgeTarget->vertices['from']);
83 | $edge->addAttribute('target', $edgeTarget->vertices['to']);
84 | if (null !== ($value = $edgeTarget->getValue())) {
85 | $data = $edge->addChild('data', $value);
86 | $data->addAttribute('key', 'd1');
87 | }
88 | }
89 | }
90 |
91 | $dom = new DOMDocument('1.0');
92 | $dom->preserveWhiteSpace = false;
93 | $dom->formatOutput = true;
94 | $dom->loadXML($export->asXML());
95 |
96 | return $dom->saveXML();
97 | }
98 |
99 | /**
100 | * Saves given data to a files.
101 | *
102 | * @param mixed $data The data to be saved
103 | * @param string $file Filename where the data should be saved to
104 | * @throws \InvalidArgumentException
105 | */
106 | public function saveToFile($data, $file)
107 | {
108 | $dir = dirname($file);
109 | if (!is_writable($dir)) {
110 | throw new InvalidArgumentException('Directory '.$dir.' not writable. Cannot write to '.$file.'.');
111 | }
112 | $handle = fopen($file, 'w');
113 | fwrite($handle, $data);
114 | fclose($handle);
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/src/Persistence/ImportGraph.php:
--------------------------------------------------------------------------------
1 | import = new SimpleXMLElement($importRaw);
33 | $directionality = (string) $this->import->graph['edgedefault'];
34 |
35 | if ($directionality === 'directed') {
36 | $graph = new DirectedGraph();
37 | } elseif ($directionality === 'undirected') {
38 | $graph = new UndirectedGraph();
39 | }
40 |
41 | foreach ($this->import->graph->node as $node) {
42 | $vertex = (string) $node['id'];
43 | $value = (string) $node->data;
44 | if (empty($value)) {
45 | $default = $this->import->xpath('key[@for="node"]/default');
46 | if (!empty($default)) {
47 | $value = (string) $default;
48 | }
49 | }
50 | $graph->addVertex($vertex);
51 | $graph->vertices[$vertex]->setValue($value);
52 | }
53 |
54 | foreach ($this->import->graph->edge as $edge) {
55 | $edgeSource = (string) $edge['source'];
56 | $edgeTarget = (string) $edge['target'];
57 | $value = (string) $edge->data;
58 | if (empty($value)) {
59 | $default = $this->import->xpath('key[@for="edge"]/default');
60 | if (!empty($default)) {
61 | $value = (string) $default;
62 | }
63 | }
64 | $graph->addEdge($edgeSource, $edgeTarget);
65 | $graph->edge($edgeSource, $edgeTarget)->setValue($value);
66 | }
67 |
68 | return $graph;
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/Vertex/DirectedVertex.php:
--------------------------------------------------------------------------------
1 | neighbors['in'] = array();
21 | $this->neighbors['out'] = array();
22 | }
23 |
24 | /**
25 | * Adds a neighboring, incoming, directed vertex to this vertex.
26 | *
27 | * @param string $vertex ID of the vertex
28 | */
29 | public function addInNeighbor($vertex)
30 | {
31 | $this->neighbors['in'][] = $vertex;
32 | }
33 |
34 | /**
35 | * Removes a neighboring, incoming, directed vertex from this vertex.
36 | *
37 | * @param string $vertex ID of the vertex
38 | */
39 | public function removeInNeighbor($vertex)
40 | {
41 | if (($key = array_search($vertex, $this->neighbors['in'])) !== false) {
42 | unset($this->neighbors['in'][$key]);
43 | }
44 | }
45 |
46 | /**
47 | * Returns an array of all incoming neighbor vertices.
48 | *
49 | * @return array Array of all incoming neighbor vertices
50 | */
51 | public function getInNeighbors()
52 | {
53 | return $this->neighbors['in'];
54 | }
55 |
56 | /**
57 | * Adds a neighboring, outgoing, directed vertex to this vertex.
58 | *
59 | * @param string $vertex ID of the vertex
60 | */
61 | public function addOutNeighbor($vertex)
62 | {
63 | $this->neighbors['out'][] = $vertex;
64 | }
65 |
66 | /**
67 | * Removes a neighboring, outgoing, directed vertex from this vertex.
68 | *
69 | * @param string $vertex ID of the vertex
70 | */
71 | public function removeOutNeighbor($vertex)
72 | {
73 | if (($key = array_search($vertex, $this->neighbors['out'])) !== false) {
74 | unset($this->neighbors['out'][$key]);
75 | }
76 | }
77 |
78 | /**
79 | * Returns an array of all outgoing neighbor vertices.
80 | *
81 | * @return string[] Array of all outgoing neighbor vertices
82 | */
83 | public function getOutNeighbors()
84 | {
85 | return $this->neighbors['out'];
86 | }
87 |
88 | /**
89 | * Returns an Direct of all neighboring vertices.
90 | *
91 | * @return string[] Array of all neighboring vertices
92 | */
93 | public function getNeighbors()
94 | {
95 | return $this->neighbors;
96 | }
97 |
98 | /**
99 | * Returns the number of incoming neighbor vertices (indegree).
100 | *
101 | * @return int Number of incoming vertices
102 | */
103 | public function getIndegree()
104 | {
105 | return count($this->neighbors['in']);
106 | }
107 |
108 | /**
109 | * Returns the number of outgoing neighbor vertices (outdegree).
110 | *
111 | * @return int Number of outgoing vertices
112 | */
113 | public function getOutdegree()
114 | {
115 | return count($this->neighbors['out']);
116 | }
117 |
118 | /**
119 | * Checks if a given vertex is an incoming neighbor of this vertex.
120 | *
121 | * @param string $vertex ID of vertex
122 | *
123 | * @return bool Whether given vertex is an incoming neighbor of this vertex
124 | */
125 | public function inAdjacent($vertex)
126 | {
127 | return in_array($vertex, $this->neighbors['in']);
128 | }
129 |
130 | /**
131 | * Checks if a given vertex is an outgoing neighbor of this vertex.
132 | *
133 | * @param string $vertex ID of vertex
134 | *
135 | * @return bool Whether given vertex is an outgoing neighbor of this vertex
136 | */
137 | public function outAdjacent($vertex)
138 | {
139 | return in_array($vertex, $this->neighbors['out']);
140 | }
141 |
142 | /**
143 | * Checks if a given vertex is adjacent to this vertex.
144 | *
145 | * @param string $vertex ID of vertex
146 | *
147 | * @return bool Whether given vertex is adjacent to this vertex
148 | */
149 | public function adjacent($vertex)
150 | {
151 | return in_array($vertex, $this->neighbors['in']) || in_array($vertex, $this->neighbors['out']);
152 | }
153 | }
154 |
--------------------------------------------------------------------------------
/src/Vertex/UndirectedVertex.php:
--------------------------------------------------------------------------------
1 | neighbors[] = $vertex;
20 | }
21 |
22 | /**
23 | * Removes a neighboring, undirected vertex from this vertex.
24 | *
25 | * @param string $vertex ID of vertex
26 | */
27 | public function removeNeighbor($vertex)
28 | {
29 | if (($key = array_search($vertex, $this->neighbors)) !== false) {
30 | unset($this->neighbors[$key]);
31 | }
32 | }
33 |
34 | /**
35 | * Returns an array of all neighboring vertices of this vertex.
36 | *
37 | * @return string[] Array of all neighboring vertices of this vertex
38 | */
39 | public function getNeighbors()
40 | {
41 | return $this->neighbors;
42 | }
43 |
44 | /**
45 | * Checks if a given vertex is adjacent to this vertex.
46 | *
47 | * @param string $vertex ID of vertex
48 | *
49 | * @return bool Whether given vertex is adjacent to this vertex
50 | */
51 | public function adjacent($vertex)
52 | {
53 | return in_array($vertex, $this->neighbors);
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Vertex/Vertex.php:
--------------------------------------------------------------------------------
1 | value = null;
32 | $this->neighbors = array();
33 | }
34 |
35 | /**
36 | * Gets the value associated with this vertex.
37 | *
38 | * @return mixed Value associated with this vertex
39 | */
40 | public function getValue()
41 | {
42 | return $this->value;
43 | }
44 |
45 | /**
46 | * Sets the value associated with this vertex.
47 | *
48 | * @param mixed $value Value to be associated with this vertex
49 | */
50 | public function setValue($value = null)
51 | {
52 | $this->value = $value;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/tests/Algo/BFSTest.php:
--------------------------------------------------------------------------------
1 | addVerticesAndEdgesForTraversalTests($directedGraph);
25 |
26 | $this->SUT = new BFS($directedGraph);
27 |
28 | $this->SUT->run('A');
29 | $res_A = $this->SUT->get();
30 |
31 | $this->assertEquals(0, $res_A['dist']['A']);
32 | $this->assertEquals(1, $res_A['dist']['B']);
33 | $this->assertEquals(1, $res_A['dist']['C']);
34 | $this->assertEquals(2, $res_A['dist']['D']);
35 | $this->assertEquals(2, $res_A['dist']['E']);
36 |
37 | $this->assertEquals(null, $res_A['parent']['A']);
38 | $this->assertEquals('A', $res_A['parent']['B']);
39 | $this->assertEquals('A', $res_A['parent']['C']);
40 | $this->assertEquals('B', $res_A['parent']['D']);
41 | $this->assertEquals('C', $res_A['parent']['E']);
42 |
43 | $expected_discovered = array('A', 'B', 'C', 'D', 'E');
44 | $this->assertEquals($expected_discovered, $res_A['discovered']);
45 |
46 | $this->SUT->run('C');
47 | $res_C = $this->SUT->get();
48 | $expected_discovered = array('C', 'E');
49 | $this->assertEquals($expected_discovered, $res_C['discovered']);
50 | }
51 |
52 | public function testBFSWithUndirectedGraph()
53 | {
54 | $undirectedGraph = new UndirectedGraph();
55 |
56 | $this->addVerticesAndEdgesForTraversalTests($undirectedGraph);
57 |
58 | $d = new BFS($undirectedGraph);
59 |
60 | $d->run('A');
61 | $res_A = $d->get();
62 |
63 | $this->assertEquals(0, $res_A['dist']['A']);
64 | $this->assertEquals(1, $res_A['dist']['B']);
65 | $this->assertEquals(1, $res_A['dist']['C']);
66 | $this->assertEquals(2, $res_A['dist']['D']);
67 | $this->assertEquals(2, $res_A['dist']['E']);
68 |
69 | $this->assertEquals(null, $res_A['parent']['A']);
70 | $this->assertEquals('A', $res_A['parent']['B']);
71 | $this->assertEquals('A', $res_A['parent']['C']);
72 | $this->assertEquals('B', $res_A['parent']['D']);
73 | $this->assertEquals('C', $res_A['parent']['E']);
74 |
75 | $expected_discovered = array('A', 'B', 'C', 'D', 'E');
76 | $this->assertEquals($expected_discovered, $res_A['discovered']);
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/tests/Algo/DFSTest.php:
--------------------------------------------------------------------------------
1 | addVerticesAndEdgesForTraversalTests($directedGraph);
24 |
25 | $this->SUT = new DFS($directedGraph);
26 |
27 | $this->SUT->run('A');
28 | $res_A = $this->SUT->get();
29 |
30 | $this->assertEquals(0, $res_A['dist']['A']);
31 | $this->assertEquals(1, $res_A['dist']['B']);
32 | $this->assertEquals(1, $res_A['dist']['C']);
33 | $this->assertEquals(2, $res_A['dist']['D']);
34 | $this->assertEquals(2, $res_A['dist']['E']);
35 |
36 | $this->assertEquals(null, $res_A['parent']['A']);
37 | $this->assertEquals('A', $res_A['parent']['B']);
38 | $this->assertEquals('A', $res_A['parent']['C']);
39 | $this->assertEquals('B', $res_A['parent']['D']);
40 | $this->assertEquals('C', $res_A['parent']['E']);
41 |
42 | $expected_discovered = array('A', 'C', 'E', 'B', 'D');
43 | $this->assertEquals($expected_discovered, $res_A['discovered']);
44 |
45 | $this->SUT->run('C');
46 | $res_C = $this->SUT->get();
47 | $expected_discovered = array('C', 'E');
48 | $this->assertEquals($expected_discovered, $res_C['discovered']);
49 | }
50 |
51 | public function testDFSWithUndirectedGraph()
52 | {
53 | $undirectedGraph = new UndirectedGraph();
54 | $this->addVerticesAndEdgesForTraversalTests($undirectedGraph);
55 |
56 | $this->SUT = new DFS($undirectedGraph);
57 |
58 | $this->SUT->run('A');
59 | $res_A = $this->SUT->get();
60 |
61 | $this->assertEquals(0, $res_A['dist']['A']);
62 | $this->assertEquals(1, $res_A['dist']['B']);
63 | $this->assertEquals(1, $res_A['dist']['C']);
64 | $this->assertEquals(2, $res_A['dist']['D']);
65 | $this->assertEquals(2, $res_A['dist']['E']);
66 |
67 | $this->assertEquals(null, $res_A['parent']['A']);
68 | $this->assertEquals('A', $res_A['parent']['B']);
69 | $this->assertEquals('A', $res_A['parent']['C']);
70 | $this->assertEquals('B', $res_A['parent']['D']);
71 | $this->assertEquals('C', $res_A['parent']['E']);
72 |
73 | $expected_discovered = array('A', 'C', 'E', 'B', 'D');
74 | $this->assertEquals($expected_discovered, $res_A['discovered']);
75 | }
76 |
77 |
78 | }
--------------------------------------------------------------------------------
/tests/Algo/DijkstraMultiTest.php:
--------------------------------------------------------------------------------
1 | addEdgesAndVertices($directedGraph);
22 |
23 | $this->SUT = new DijkstraMulti($directedGraph);
24 |
25 | $this->SUT->run('A');
26 | $res_J = $this->SUT->get('J');
27 |
28 | $this->assertNotEmpty($res_J['paths']);
29 | $expected_paths = array(
30 | array('A', 'B', 'J'),
31 | array('A', 'C', 'E', 'F', 'J'),
32 | array('A', 'C', 'D', 'F', 'J'),
33 | array('A', 'G', 'H', 'I', 'J')
34 | );
35 |
36 | $this->assertEquals($expected_paths, $res_J['paths'], "\$canonicalize = true", $delta = 0.0, $maxDepth = 10, $canonicalize = true);
37 | $this->assertEquals(10, $res_J['dist']);
38 |
39 | $this->SUT->run('C');
40 | $res_J = $this->SUT->get('J');
41 | $expected_paths = array(
42 | array('C', 'D', 'F', 'J'),
43 | array('C', 'E', 'F', 'J')
44 | );
45 | $this->assertEquals($expected_paths, $res_J['paths'], "\$canonicalize = true", $delta = 0.0, $maxDepth = 10, $canonicalize = true);
46 | $this->assertEquals(7, $res_J['dist']);
47 |
48 | $this->SUT->run('J');
49 | $res_C = $this->SUT->get('C');
50 |
51 | $this->assertEmpty($res_C['paths']);
52 | $this->assertEquals(INF, $res_C['dist']);
53 |
54 | }
55 |
56 | public function testDijkstraMultiWithUndirectedGraph()
57 | {
58 | $undirectedGraph = new UndirectedGraph();
59 |
60 | $this->addEdgesAndVertices($undirectedGraph);
61 |
62 | $this->SUT = new DijkstraMulti($undirectedGraph);
63 |
64 | $this->SUT->run('A');
65 | $res_J = $this->SUT->get('J');
66 |
67 | $this->assertNotEmpty($res_J['paths']);
68 | $expected_paths = array(
69 | array('A', 'B', 'J'),
70 | array('A', 'C', 'E', 'F', 'J'),
71 | array('A', 'C', 'D', 'F', 'J'),
72 | array('A', 'G', 'H', 'I', 'J')
73 | );
74 | $this->assertEquals($expected_paths, $res_J['paths'], "\$canonicalize = true", $delta = 0.0, $maxDepth = 10, $canonicalize = true);
75 | $this->assertEquals(10, $res_J['dist']);
76 |
77 | $this->SUT->run('C');
78 | $res_J = $this->SUT->get('J');
79 | $expected_paths = array(
80 | array('C', 'D', 'F', 'J'),
81 | array('C', 'E', 'F', 'J')
82 | );
83 | $this->assertEquals($expected_paths, $res_J['paths'], "\$canonicalize = true", $delta = 0.0, $maxDepth = 10, $canonicalize = true);
84 | $this->assertEquals(7, $res_J['dist']);
85 |
86 | $this->SUT->run('J');
87 | $res_C = $this->SUT->get('C');
88 | $expected_paths = array(
89 | array('J', 'F', 'D', 'C'),
90 | array('J', 'F', 'E', 'C')
91 | );
92 | $this->assertEquals($expected_paths, $res_C['paths'], "\$canonicalize = true", $delta = 0.0, $maxDepth = 10, $canonicalize = true);
93 | $this->assertEquals(7, $res_C['dist']);
94 | }
95 |
96 | /**
97 | * @param Graph|DirectedGraph|UndirectedGraph $graph
98 | */
99 | private function addEdgesAndVertices(Graph $graph)
100 | {
101 | $graph->addVertex('A');
102 | $graph->addVertex('B');
103 | $graph->addVertex('C');
104 | $graph->addVertex('D');
105 | $graph->addVertex('E');
106 | $graph->addVertex('F');
107 | $graph->addVertex('G');
108 | $graph->addVertex('H');
109 | $graph->addVertex('I');
110 | $graph->addVertex('J');
111 | $graph->addVertex('K');
112 |
113 | $graph->addEdge('A', 'B', 5);
114 | $graph->addEdge('A', 'C', 3);
115 | $graph->addEdge('A', 'G', 3);
116 | $graph->addEdge('B', 'F', 3);
117 | $graph->addEdge('B', 'J', 5);
118 | $graph->addEdge('B', 'K', 2);
119 | $graph->addEdge('C', 'B', 3);
120 | $graph->addEdge('C', 'D', 2);
121 | $graph->addEdge('C', 'E', 1);
122 | $graph->addEdge('D', 'F', 2);
123 | $graph->addEdge('E', 'F', 3);
124 | $graph->addEdge('F', 'I', 2);
125 | $graph->addEdge('F', 'J', 3);
126 | $graph->addEdge('G', 'E', 4);
127 | $graph->addEdge('G', 'H', 3);
128 | $graph->addEdge('H', 'I', 2);
129 | $graph->addEdge('I', 'J', 2);
130 | $graph->addEdge('I', 'K', 3);
131 | $graph->addEdge('J', 'K', 7);
132 | }
133 | }
134 |
--------------------------------------------------------------------------------
/tests/Algo/DijkstraTest.php:
--------------------------------------------------------------------------------
1 | addVerticesAndEdgesForShortestPathTests($directedGraph);
25 |
26 | $this->SUT = new Dijkstra($directedGraph);
27 |
28 | $this->SUT->run('A');
29 | $res_E = $this->SUT->get('E');
30 |
31 | $this->assertEmpty($res_E['path']);
32 | $this->assertEquals(INF, $res_E['dist']);
33 |
34 | $res_C = $this->SUT->get('C');
35 | $expected_path = array('A', 'B', 'F', 'C');
36 | $this->assertEquals($expected_path, $res_C['path']);
37 | $this->assertEquals(40, $res_C['dist']);
38 |
39 | $this->SUT->run('B');
40 | $res_A = $this->SUT->get('A');
41 | $expected_path = array('B', 'F', 'C', 'D', 'G', 'A');
42 | $this->assertEquals($expected_path, $res_A['path']);
43 | $this->assertEquals(70, $res_A['dist']);
44 | }
45 |
46 | public function testDijkstraWithUndirectedGraph()
47 | {
48 | $undirectedGraph = new UndirectedGraph();
49 |
50 | $this->addVerticesAndEdgesForShortestPathTests($undirectedGraph);
51 |
52 | $this->SUT = new Dijkstra($undirectedGraph);
53 |
54 | $this->SUT->run('A');
55 | $res_E = $this->SUT->get('E');
56 |
57 | $this->assertNotEmpty($res_E['path']);
58 | $expected_path = array('A', 'B', 'E');
59 | $this->assertEquals($expected_path, $res_E['path']);
60 | $this->assertEquals(70, $res_E['dist']);
61 |
62 | $res_C = $this->SUT->get('C');
63 | $expected_path = array('A', 'B', 'F', 'C');
64 | $this->assertEquals($expected_path, $res_C['path']);
65 | $this->assertEquals(80, $res_C['dist']);
66 |
67 | $this->SUT->run('B');
68 | $res_A = $this->SUT->get('A');
69 | $expected_path = array('B', 'A');
70 | $this->assertEquals($expected_path, $res_A['path']);
71 | $this->assertEquals(20, $res_A['dist']);
72 | }
73 | }
--------------------------------------------------------------------------------
/tests/Algo/FloydWarshallTest.php:
--------------------------------------------------------------------------------
1 | addVerticesAndEdgesForShortestPathTests($directedGraph);
25 |
26 | $this->SUT = new FloydWarshall($directedGraph);
27 |
28 | $this->SUT->run();
29 | $res_E = $this->SUT->get('A', 'E');
30 |
31 | $this->assertEmpty($res_E['path']);
32 | $this->assertEquals(null, $res_E['dist']);
33 |
34 | $res_C = $this->SUT->get('A', 'C');
35 | $expected_path = array('A', 'B', 'F', 'C');
36 | $this->assertEquals($expected_path, $res_C['path']);
37 | $this->assertEquals(40, $res_C['dist']);
38 |
39 | $res_A = $this->SUT->get('B', 'A');
40 | $expected_path = array('B', 'F', 'C', 'D', 'G', 'A');
41 | $this->assertEquals($expected_path, $res_A['path']);
42 | $this->assertEquals(70, $res_A['dist']);
43 | }
44 |
45 | public function testFloydWarshallWithUndirectedGraph()
46 | {
47 | $undirectedGraph = new UndirectedGraph();
48 |
49 | $this->addVerticesAndEdgesForShortestPathTests($undirectedGraph);
50 |
51 | $this->SUT = new FloydWarshall($undirectedGraph);
52 |
53 | $this->SUT->run();
54 | $res_E = $this->SUT->get('A', 'E');
55 |
56 | $this->assertNotEmpty($res_E['path']);
57 | $expected_path = array('A', 'B', 'E');
58 | $this->assertEquals($expected_path, $res_E['path']);
59 | $this->assertEquals(70, $res_E['dist']);
60 |
61 | $res_C = $this->SUT->get('A', 'C');
62 | $expected_path = array('A', 'B', 'F', 'C');
63 | $this->assertEquals($expected_path, $res_C['path']);
64 | $this->assertEquals(80, $res_C['dist']);
65 |
66 | $res_A = $this->SUT->get('B', 'A');
67 | $expected_path = array('B', 'A');
68 | $this->assertEquals($expected_path, $res_A['path']);
69 | $this->assertEquals(20, $res_A['dist']);
70 | }
71 | }
--------------------------------------------------------------------------------
/tests/Algo/YenTest.php:
--------------------------------------------------------------------------------
1 | addEdgesAndVertices($directedGraph);
25 |
26 | $this->SUT = new Yen($directedGraph);
27 |
28 | $this->SUT->run('C', 'H', '3');
29 | $result = $this->SUT->get();
30 |
31 | $expected = array(
32 | array(
33 | 'path' => array('C', 'E', 'F', 'H'),
34 | 'dist' => 5,
35 | ),
36 | array(
37 | 'path' => array('C', 'E', 'G', 'H'),
38 | 'dist' => 7,
39 | ),
40 | array(
41 | 'path' => array('C', 'D', 'F', 'H'),
42 | 'dist' => 8,
43 | ),
44 | );
45 | $this->assertEquals($expected, $result);
46 | }
47 |
48 | public function testYenWithUndirectedGraph()
49 | {
50 | $undirectedGraph = new UndirectedGraph();
51 |
52 | $this->addEdgesAndVertices($undirectedGraph);
53 |
54 | $this->SUT = new Yen($undirectedGraph);
55 |
56 | $this->SUT->run('C', 'H', '3');
57 | $result = $this->SUT->get();
58 |
59 | $expected = array(
60 | array(
61 | 'path' => array('C', 'E', 'F', 'H'),
62 | 'dist' => 5,
63 | ),
64 | array(
65 | 'path' => array('C', 'D', 'E', 'F', 'H'),
66 | 'dist' => 7,
67 | ),
68 | array(
69 | 'path' => array('C', 'D', 'F', 'H'),
70 | 'dist' => 8,
71 | ),
72 | );
73 | $this->assertEquals($expected, $result);
74 | }
75 |
76 | /**
77 | * @param Graph|DirectedGraph|UndirectedGraph $graph
78 | */
79 | private function addEdgesAndVertices(Graph $graph)
80 | {
81 | $graph->addVertex('C');
82 | $graph->addVertex('D');
83 | $graph->addVertex('E');
84 | $graph->addVertex('F');
85 | $graph->addVertex('G');
86 | $graph->addVertex('H');
87 |
88 | $graph->addEdge('C', 'D', 3);
89 | $graph->addEdge('C', 'E', 2);
90 | $graph->addEdge('E', 'D', 1);
91 | $graph->addEdge('D', 'F', 4);
92 | $graph->addEdge('E', 'F', 2);
93 | $graph->addEdge('E', 'G', 3);
94 | $graph->addEdge('F', 'G', 2);
95 | $graph->addEdge('F', 'H', 1);
96 | $graph->addEdge('G', 'H', 2);
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/tests/Graph/DirectedGraphTest.php:
--------------------------------------------------------------------------------
1 | SUT = new DirectedGraph();
27 | }
28 |
29 | public function testVertexAddRemove()
30 | {
31 | $this->SUT->addVertex('A');
32 | $this->assertArrayHasKey('A', $this->SUT->vertices);
33 | $this->SUT->addVertex('B');
34 | $this->assertArrayHasKey('B', $this->SUT->vertices);
35 | $this->SUT->addVertex('C');
36 | $this->assertArrayHasKey('C', $this->SUT->vertices);
37 | $this->SUT->addEdge('A', 'B');
38 | $this->assertArrayHasKey('B', $this->SUT->edges['A']);
39 | $this->SUT->addEdge('A', 'C');
40 | $this->assertArrayHasKey('C', $this->SUT->edges['A']);
41 | $this->assertContains('C', $this->SUT->vertices['A']->getOutNeighbors());
42 | $this->SUT->removeVertex('C');
43 | $this->assertArrayNotHasKey('C', $this->SUT->vertices);
44 | $this->assertArrayNotHasKey('C', $this->SUT->edges['A']);
45 | $this->assertNotContains('C', $this->SUT->vertices['A']->getOutNeighbors());
46 | $this->SUT->removeVertex('B');
47 | $this->assertArrayNotHasKey('B', $this->SUT->vertices);
48 | $this->assertArrayNotHasKey('A', $this->SUT->edges);
49 | }
50 |
51 | public function testEdgeAddRemove()
52 | {
53 | $this->SUT->addVertex('A');
54 | $this->SUT->addVertex('B');
55 | $this->SUT->addEdge('A', 'B');
56 | $this->assertEquals(true, isset($this->SUT->edges['A']['B']));
57 | $this->assertEquals(false, isset($this->SUT->edges['B']['A']));
58 | $this->assertContains('B', $this->SUT->vertices['A']->getOutNeighbors());
59 | $this->assertContains('A', $this->SUT->vertices['B']->getInNeighbors());
60 | $this->assertNotContains('B', $this->SUT->vertices['A']->getInNeighbors());
61 | $this->assertNotContains('A', $this->SUT->vertices['B']->getOutNeighbors());
62 | $this->SUT->removeEdge('A', 'B');
63 | $this->assertEquals(false, isset($this->SUT->edges['A']['B']));
64 | $this->assertEquals(false, isset($this->SUT->edges['B']['A']));
65 | $this->assertNotContains('B', $this->SUT->vertices['A']->getOutNeighbors());
66 | $this->assertNotContains('A', $this->SUT->vertices['B']->getInNeighbors());
67 | }
68 |
69 | public function testVertexGetSetValue()
70 | {
71 | $this->SUT->addVertex('A');
72 | $this->SUT->vertices['A']->setValue('testval1');
73 | $this->assertEquals('testval1', $this->SUT->vertices['A']->getValue());
74 | $this->SUT->addVertex('B');
75 | $this->SUT->vertices['B']->setValue('testval2');
76 | $this->assertEquals('testval2', $this->SUT->vertices['B']->getValue());
77 | }
78 |
79 | public function testEdgeGetSetValue()
80 | {
81 | $this->SUT->addVertex('A');
82 | $this->SUT->addVertex('B');
83 | $this->SUT->addVertex('C');
84 | $this->SUT->addEdge('A', 'B');
85 | $this->SUT->addEdge('A', 'C');
86 | $this->SUT->addEdge('C', 'A');
87 | $this->SUT->edges['A']['B']->setValue(1.0);
88 | $this->SUT->edges['A']['C']->setValue(1.1);
89 | $this->SUT->edges['C']['A']->setValue(2);
90 | $this->assertEquals('1.0', $this->SUT->edges['A']['B']->getValue());
91 | $this->assertEquals('1.1', $this->SUT->edges['A']['C']->getValue());
92 | $this->assertEquals('2', $this->SUT->edges['C']['A']->getValue());
93 | }
94 |
95 | public function testVertexAdjacencyMethods()
96 | {
97 | $this->SUT->addVertex('A');
98 | $this->SUT->addVertex('B');
99 | $this->SUT->addVertex('C');
100 | $this->SUT->addVertex('D');
101 | $this->SUT->addEdge('A', 'B');
102 | $this->SUT->addEdge('A', 'C');
103 | $this->SUT->addEdge('C', 'B');
104 | $this->assertEquals(true, $this->SUT->vertices['A']->outAdjacent('B'));
105 | $this->assertEquals(false, $this->SUT->vertices['B']->outAdjacent('A'));
106 | $this->assertEquals(true, $this->SUT->vertices['C']->inAdjacent('A'));
107 | $this->assertEquals(false, $this->SUT->vertices['A']->inAdjacent('C'));
108 | $this->assertEquals(true, $this->SUT->vertices['A']->adjacent('B'));
109 | $this->assertEquals(true, $this->SUT->vertices['B']->adjacent('A'));
110 | $this->assertEquals(true, $this->SUT->vertices['C']->adjacent('A'));
111 | $this->assertEquals(true, $this->SUT->vertices['A']->adjacent('C'));
112 | $this->assertEquals(false, $this->SUT->vertices['A']->adjacent('D'));
113 | $this->assertEquals(false, $this->SUT->vertices['D']->adjacent('A'));
114 | }
115 |
116 | public function testIndegreeAndOutdegree()
117 | {
118 | $this->SUT->addVertex('A');
119 | $this->SUT->addVertex('B');
120 | $this->SUT->addVertex('C');
121 | $this->SUT->addEdge('A', 'B');
122 | $this->SUT->addEdge('A', 'C');
123 | $this->SUT->addEdge('C', 'A');
124 | $this->assertEquals(1, $this->SUT->vertices['A']->getIndegree());
125 | $this->assertEquals(2, $this->SUT->vertices['A']->getOutdegree());
126 | $this->assertEquals(1, $this->SUT->vertices['B']->getIndegree());
127 | $this->assertEquals(0, $this->SUT->vertices['B']->getOutdegree());
128 | $this->assertEquals(1, $this->SUT->vertices['C']->getIndegree());
129 | $this->assertEquals(1, $this->SUT->vertices['C']->getOutdegree());
130 | }
131 |
132 | public function testVertexAndEdgeCount()
133 | {
134 | $this->SUT->addVertex('A');
135 | $this->SUT->addVertex('B');
136 | $this->SUT->addVertex('C');
137 | $this->SUT->addVertex('D');
138 | $this->SUT->removeVertex('D');
139 | $this->SUT->addEdge('A', 'B');
140 | $this->SUT->addEdge('A', 'C');
141 | $this->SUT->addEdge('C', 'A');
142 | $this->SUT->removeEdge('A', 'C');
143 | $this->assertEquals(3, $this->SUT->getVertexCount());
144 | $this->assertEquals(2, $this->SUT->getEdgeCount());
145 | }
146 |
147 | public function testTranspose()
148 | {
149 | $this->SUT->addVertex('A');
150 | $this->SUT->addVertex('B');
151 | $this->SUT->addVertex('C');
152 | $this->SUT->addVertex('D');
153 | $this->SUT->addVertex('E');
154 |
155 | $this->SUT->addEdge('A', 'B', 1);
156 | $this->SUT->addEdge('A', 'C', 1);
157 | $this->SUT->addEdge('B', 'D', 1);
158 | $this->SUT->addEdge('C', 'E', 1);
159 |
160 | $originalGraph = clone $this->SUT;
161 | $transposedGraph = $this->SUT->getTranspose();
162 |
163 | $this->assertEquals($this->SUT, $originalGraph);
164 | $this->assertNull($this->SUT->edge('B', 'A'));
165 | $this->assertNotNull($this->SUT->edge('A', 'B'));
166 | $this->assertEquals(1, $this->SUT->edge('A', 'B')->getValue());
167 | $this->assertNull($transposedGraph->edge('A', 'B'));
168 | $this->assertNotNull($transposedGraph->edge('B', 'A'));
169 | $this->assertEquals(1, $transposedGraph->edge('B', 'A')->getValue());
170 | }
171 | }
172 |
--------------------------------------------------------------------------------
/tests/Graph/UndirectedGraphTest.php:
--------------------------------------------------------------------------------
1 | SUT = new UndirectedGraph();
20 | }
21 |
22 | public function testVertexAddRemove()
23 | {
24 | $this->SUT->addVertex('A');
25 | $this->assertArrayHasKey('A', $this->SUT->vertices);
26 | $this->SUT->addVertex('B');
27 | $this->assertArrayHasKey('B', $this->SUT->vertices);
28 | $this->SUT->addVertex('C');
29 | $this->assertArrayHasKey('C', $this->SUT->vertices);
30 | $this->SUT->addEdge('A', 'B');
31 | $this->assertArrayHasKey('B', $this->SUT->edges['A']);
32 | $this->SUT->addEdge('A', 'C');
33 | $this->assertArrayHasKey('C', $this->SUT->edges['A']);
34 | $this->assertContains('C', $this->SUT->vertices['A']->getNeighbors());
35 | $this->SUT->removeVertex('C');
36 | $this->assertArrayNotHasKey('C', $this->SUT->vertices);
37 | $this->assertArrayNotHasKey('C', $this->SUT->edges['A']);
38 | $this->assertNotContains('C', $this->SUT->vertices['A']->getNeighbors());
39 | $this->SUT->removeVertex('B');
40 | $this->assertArrayNotHasKey('B', $this->SUT->vertices);
41 | $this->assertArrayNotHasKey('A', $this->SUT->edges);
42 | }
43 |
44 | public function testEdgeAddRemove()
45 | {
46 | $this->SUT->addVertex('A');
47 | $this->SUT->addVertex('B');
48 | $this->SUT->addEdge('A', 'B');
49 | $this->assertNotNull($this->SUT->edge('A', 'B'));
50 | $this->assertNotNull($this->SUT->edge('B', 'A'));
51 | $this->assertContains('B', $this->SUT->vertices['A']->getNeighbors());
52 | $this->assertContains('A', $this->SUT->vertices['B']->getNeighbors());
53 | $this->SUT->removeEdge('A', 'B');
54 | $this->assertNull($this->SUT->edge('A', 'B'));
55 | $this->assertNull($this->SUT->edge('B', 'A'));
56 | $this->SUT->addEdge('A', 'B');
57 | $this->SUT->removeEdge('B', 'A');
58 | $this->assertNull($this->SUT->edge('A', 'B'));
59 | $this->assertNull($this->SUT->edge('B', 'A'));
60 | $this->assertNotContains('B', $this->SUT->vertices['A']->getNeighbors());
61 | $this->assertNotContains('A', $this->SUT->vertices['B']->getNeighbors());
62 | }
63 |
64 | public function testVertexGetSetValue()
65 | {
66 | $this->SUT->addVertex('A');
67 | $this->SUT->vertices['A']->setValue('testval1');
68 | $this->assertEquals('testval1', $this->SUT->vertices['A']->getValue());
69 | $this->SUT->addVertex('B');
70 | $this->SUT->vertices['B']->setValue('testval2');
71 | $this->assertEquals('testval2', $this->SUT->vertices['B']->getValue());
72 | }
73 |
74 | public function testEdgeGetSetValue()
75 | {
76 | $this->SUT->addVertex('A');
77 | $this->SUT->addVertex('B');
78 | $this->SUT->addVertex('C');
79 | $this->SUT->addEdge('A', 'B');
80 | $this->SUT->addEdge('A', 'C');
81 | $this->SUT->edge('A', 'B')->setValue(1.0);
82 | $this->SUT->edge('A', 'C')->setValue(1.1);
83 | $this->SUT->edge('C', 'A')->setValue(2);
84 | $this->assertEquals(1.0, $this->SUT->edge('A', 'B')->getValue());
85 | $this->assertEquals(2, $this->SUT->edge('A', 'C')->getValue());
86 | $this->assertEquals(2, $this->SUT->edge('C', 'A')->getValue());
87 | }
88 |
89 | public function testVertexAdjacencyMethods()
90 | {
91 | $this->SUT->addVertex('A');
92 | $this->SUT->addVertex('B');
93 | $this->SUT->addVertex('C');
94 | $this->SUT->addVertex('D');
95 | $this->SUT->addEdge('A', 'B');
96 | $this->SUT->addEdge('A', 'C');
97 | $this->SUT->addEdge('C', 'B');
98 | $this->assertEquals(true, $this->SUT->vertices['A']->adjacent('B'));
99 | $this->assertEquals(true, $this->SUT->vertices['B']->adjacent('A'));
100 | $this->assertEquals(true, $this->SUT->vertices['C']->adjacent('A'));
101 | $this->assertEquals(true, $this->SUT->vertices['A']->adjacent('C'));
102 | $this->assertEquals(false, $this->SUT->vertices['A']->adjacent('D'));
103 | $this->assertEquals(false, $this->SUT->vertices['D']->adjacent('A'));
104 | }
105 |
106 | public function testVertexAndEdgeCount()
107 | {
108 | $this->SUT->addVertex('A');
109 | $this->SUT->addVertex('B');
110 | $this->SUT->addVertex('C');
111 | $this->SUT->addVertex('D');
112 | $this->SUT->removeVertex('D');
113 | $this->SUT->addEdge('A', 'B');
114 | $this->SUT->addEdge('A', 'C');
115 | $this->SUT->addEdge('C', 'A');
116 | $this->SUT->removeEdge('A', 'C');
117 | $this->assertEquals(3, $this->SUT->getVertexCount());
118 | $this->assertEquals(1, $this->SUT->getEdgeCount());
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/tests/Persistence/ImportExportGraphTest.php:
--------------------------------------------------------------------------------
1 | addVerticesAndEdgesForShortestPathTests($graph);
25 |
26 | $graphExporter = new ExportGraph($graph);
27 | $graphMl = $graphExporter->getGraphML();
28 | $graphExporter->saveToFile($graphMl, 'graphDirected.graphml');
29 |
30 | $graphImporter = new ImportGraph();
31 | $importedGraph = $graphImporter->fromGraphML('graphDirected.graphml');
32 |
33 | $this->assertEquals($graph, $importedGraph);
34 | }
35 |
36 |
37 | /**
38 | * @return array
39 | */
40 | public function provideGraphForImportAndExport()
41 | {
42 | return array(
43 | array(new DirectedGraph()),
44 | array(new UndirectedGraph())
45 | );
46 | }
47 |
48 |
49 | }
--------------------------------------------------------------------------------
/tests/Traits/GraphInteractionTrait.php:
--------------------------------------------------------------------------------
1 | addVertex('A');
17 | $graph->addVertex('B');
18 | $graph->addVertex('C');
19 | $graph->addVertex('D');
20 | $graph->addVertex('E');
21 |
22 | $graph->addEdge('A', 'B', 1);
23 | $graph->addEdge('A', 'C', 1);
24 | $graph->addEdge('B', 'D', 1);
25 | $graph->addEdge('C', 'E', 1);
26 | }
27 |
28 | /**
29 | * @param UndirectedGraph|DirectedGraph|Graph $graph
30 | */
31 | protected function addVerticesAndEdgesForShortestPathTests(Graph $graph)
32 | {
33 | $graph->addVertex('A');
34 | $graph->addVertex('B');
35 | $graph->addVertex('C');
36 | $graph->addVertex('D');
37 | $graph->addVertex('E');
38 | $graph->addVertex('F');
39 | $graph->addVertex('G');
40 | $graph->addVertex('H');
41 |
42 | $graph->addEdge('A', 'B', 20);
43 | $graph->addEdge('A', 'D', 80);
44 | $graph->addEdge('A', 'G', 90);
45 | $graph->addEdge('B', 'F', 10);
46 | $graph->addEdge('C', 'D', 10);
47 | $graph->addEdge('C', 'F', 50);
48 | $graph->addEdge('C', 'H', 20);
49 | $graph->addEdge('D', 'C', 10);
50 | $graph->addEdge('D', 'G', 20);
51 | $graph->addEdge('E', 'B', 50);
52 | $graph->addEdge('E', 'G', 30);
53 | $graph->addEdge('F', 'C', 10);
54 | $graph->addEdge('F', 'D', 40);
55 | $graph->addEdge('G', 'A', 20);
56 | }
57 | }
58 |
--------------------------------------------------------------------------------