Changeset 873 for trunk/Modules/NetworkTopology/topologie-gen.php
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/NetworkTopology/topologie-gen.php
r548 r873 6 6 global $Database, $debug; 7 7 8 if (array_key_exists('debug', $_GET)) $debug = $_GET['debug'];8 if (array_key_exists('debug', $_GET)) $debug = $_GET['debug']; 9 9 else $debug = 0; 10 10 //$debug = 0; … … 110 110 $markskip = 0; 111 111 } 112 } while ($level >= 1);112 } while ($level >= 1); 113 113 } 114 114 … … 128 128 $Database->query("INSERT INTO NetworkTopology (Host, Depth, Pos, First, Last) '. 129 129 'VALUES (".$node->index.','.$node->level.','.$this->calc_pos($node).','.$first.','.$last.");"); 130 foreach ($node->children as $key => $value) {130 foreach ($node->children as $key => $value) { 131 131 $this->store_node($value); 132 132 } … … 149 149 $this->setborder($node->level, $this->border[$node->level+1]+1); 150 150 } 151 foreach ($node->children as $key => $value) {151 foreach ($node->children as $key => $value) { 152 152 if ($key == count($node->children)-1) { 153 if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);153 if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1); 154 154 } 155 155 $this->left_align($value); 156 156 if ($key == 0) { 157 if ($this->border[$node->level] <= $this->border[$node->level+1]) {157 if ($this->border[$node->level] <= $this->border[$node->level+1]) { 158 158 $node->pos = $this->border[$node->level+1]-1; 159 159 $this->setborder($node->level, $this->border[$node->level+1]); … … 174 174 $this->setborder($node->level, $this->border[$node->level+1]+1); 175 175 } 176 for ($key=count($node->children)-1;$key>=0;$key--) {176 for ($key=count($node->children)-1;$key>=0;$key--) { 177 177 $value = $node->children[$key]; 178 178 if ((count($value->children)>0) && count($node->order)>0) { … … 180 180 } 181 181 if ($key == 0) { 182 if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);182 if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1); 183 183 } 184 184 $this->right_align($value); 185 185 if ($key == count($node->children)-1) { 186 if ($this->border[$node->level] <= $this->border[$node->level+1]) {186 if ($this->border[$node->level] <= $this->border[$node->level+1]) { 187 187 $node->rpos = $this->border[$node->level+1]-1; 188 188 $this->setborder($node->level, $this->border[$node->level+1]); … … 196 196 /** Reset construction border **/ 197 197 function reset_border() { 198 foreach ($this->border as $key => $value) $this->border[$key] = 0;198 foreach ($this->border as $key => $value) $this->border[$key] = 0; 199 199 $this->maxborder = 0; 200 200 } … … 214 214 $target = 0; // Index cílového uzlu 215 215 $lastindex = 0; // Index poslední vydličky 216 foreach ($node->children as $key => $value) {216 foreach ($node->children as $key => $value) { 217 217 if (count($value->children)>0) { 218 218 array_push($forkmap,$value); … … 221 221 } 222 222 } 223 for ($i=0;$i<$node->forkcnt-1;$i++) {224 for ($j=0;$j<count($forkmap);$j++) {223 for ($i=0;$i<$node->forkcnt-1;$i++) { 224 for ($j=0;$j<count($forkmap);$j++) { 225 225 $this->border = $preborder; 226 226 $this->maxborder = $premax; 227 227 $k = 0; // index zpracovávané vydličky 228 foreach ($node->children as $key => $value) {228 foreach ($node->children as $key => $value) { 229 229 if (count($value->children)>0) { 230 230 if ($order[$value->index]) { … … 241 241 } 242 242 if ($key == count($node->children)-1) { 243 if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);243 if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1); 244 244 } 245 245 $this->left_align($value); 246 246 if ($key == 0) { 247 if ($this->border[$node->level] <= $this->border[$node->level+1]) {247 if ($this->border[$node->level] <= $this->border[$node->level+1]) { 248 248 $node->pos = $this->border[$node->level+1]-1; 249 249 $this->setborder($node->level, $this->border[$node->level+1]); … … 272 272 $this->setborder($node->level, $this->border[$node->level+1]+1); 273 273 } 274 foreach ($node->children as $key => $value) {274 foreach ($node->children as $key => $value) { 275 275 if ((count($value->children)>0) && count($order)>0) { 276 276 $value = $order[$value->index]; 277 277 } 278 278 if ($key == count($node->children)-1) { 279 if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);279 if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1); 280 280 } 281 281 $this->reorder($value); 282 282 if ($key == 0) { 283 if ($this->border[$node->level] <= $this->border[$node->level+1]) {283 if ($this->border[$node->level] <= $this->border[$node->level+1]) { 284 284 $node->pos = $this->border[$node->level+1]-1; 285 285 $this->setborder($node->level, $this->border[$node->level+1]); … … 301 301 } 302 302 $forkcnt = 0; // Fork counter 303 foreach ($node->children as $key => $value) {303 foreach ($node->children as $key => $value) { 304 304 if ($forkcnt == count($node->children)-1) { 305 if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);305 if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1); 306 306 } 307 307 if (count($value->children)>0) { 308 308 $this->left_stub($value); 309 309 if ($forkcnt == 0) { 310 if ($this->border[$node->level] <= $this->border[$node->level+1]) {310 if ($this->border[$node->level] <= $this->border[$node->level+1]) { 311 311 $node->pos = $this->border[$node->level+1]-1; 312 312 $this->setborder($node->level, $this->border[$node->level+1]); … … 335 335 $lastindex = 0; // Index poslední vydličky 336 336 $fact = 1; // Faktoriál kombinací vydliček 337 foreach ($node->children as $key => $value) {337 foreach ($node->children as $key => $value) { 338 338 if (count($value->children)>0) { 339 339 if ($key>0) $fact = $fact * ($key+1); … … 343 343 } 344 344 } 345 for ($i=0;$i<$node->forkcnt-1;$i++) {346 for ($j=0;$j<count($forkmap);$j++) {345 for ($i=0;$i<$node->forkcnt-1;$i++) { 346 for ($j=0;$j<count($forkmap);$j++) { 347 347 $this->border = $preborder; 348 348 $this->maxborder = $premax; 349 349 $k = 0; // index zpracovávané vydličky 350 foreach ($node->children as $key => $value) {350 foreach ($node->children as $key => $value) { 351 351 if (count($value->children)>0) { 352 352 if ($order[$value->index]) { … … 363 363 } 364 364 if ($key == count($node->children)-1) { 365 if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);365 if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1); 366 366 } 367 367 $this->left_align($value); 368 368 if ($key == 0) { 369 if ($this->border[$node->level] <= $this->border[$node->level+1]) {369 if ($this->border[$node->level] <= $this->border[$node->level+1]) { 370 370 $node->pos = $this->border[$node->level+1]-1; 371 371 $this->setborder($node->level, $this->border[$node->level+1]); … … 395 395 $this->setborder($node->level, $this->border[$node->level+1]+1); 396 396 } 397 foreach ($node->children as $key => $value) {397 foreach ($node->children as $key => $value) { 398 398 if ((count($value->children)>0) && count($order)>0) { 399 399 $value = $order[$value->index]; 400 400 } 401 401 if ($key == count($node->children)-1) { 402 if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1);402 if ($this->border[$node->level] > $this->border[$node->level+1]) $this->setborder($node->level+1, $this->border[$node->level]-1); 403 403 } 404 404 $this->reorder($value); 405 405 if ($key == 0) { 406 if ($this->border[$node->level] <= $this->border[$node->level+1]) {406 if ($this->border[$node->level] <= $this->border[$node->level+1]) { 407 407 $node->pos = $this->border[$node->level+1]-1; 408 408 $this->setborder($node->level, $this->border[$node->level+1]);
Note:
See TracChangeset
for help on using the changeset viewer.