Changeset 83


Ignore:
Timestamp:
Jun 22, 2008, 11:23:39 PM (16 years ago)
Author:
hajdam
Message:

Dokončení levé topologie s přehazováním vydlic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • www/is/topologie-gen.php

    r82 r83  
    22 // Skript pro generování grafu stromové struktury sítě do PNG obrázku
    33include('../global2.php');
    4 global $Database;
     4global $Database, $debug;
    55
    66if(array_key_exists('debug', $_GET)) $debug = $_GET['debug'];
    77else $debug = 0;
    8 // $debug = 0;
     8$debug = 0;
    99
    1010class treeitem {
     
    3535  function getFirst() {
    3636    if (count($this->children)>0) {
     37      if (count($this->order)>0) {
     38        if (count($this->children[0]->children)>0) return $this->order[$this->children[0]->index];
     39      }
    3740      return $this->children[0];
    3841    } else return null;
     
    4144  function getLast() {
    4245    if (count($this->children)>0) {
     46      if (count($this->order)>0) {
     47        if (count($this->children[count($this->children)-1]->children)>0) return $this->order[$this->children[count($this->children)-1]->index];
     48      }
    4349      return $this->children[count($this->children)-1];
    4450    } else return null;
     
    142148
    143149  function reorder($node) {
     150    global $debug;
    144151    $node->pos = $this->border[$node->level];
    145152    $this->border[$node->level]++;
     
    160167        }
    161168      }
    162       if ($node->forkcnt > 0) echo $node->index.':'.$node->forkcnt."\n";
    163169      for($i=0;$i<$node->forkcnt-1;$i++) {
    164170        for($j=0;$j<count($forkmap);$j++) {
     
    197203        }
    198204        $order[$target]=$forkmap[$bestfit];
    199         echo 'ORDER: '.$target.' > '.$forkmap[$bestfit]->index."\n";
     205        if ($debug) echo 'ORDER: '.$target.' > '.$forkmap[$bestfit]->index."\n";
    200206        array_splice($forkmap, $bestfit, 1);
    201207      }
    202208      $order[$lastindex]=$forkmap[0];
    203       echo 'ORDER: '.$lastindex.' > '.$forkmap[0]->index."\n";
     209      if ($debug) echo 'ORDER: '.$lastindex.' > '.$forkmap[0]->index."\n";
     210      if ($debug) echo 'ORDERSTORE: '.$node->index."\n";
    204211      $node->order = $order;
    205212      $this->border = $preborder;
     
    213220      foreach($node->children as $key => $value) {
    214221        if ((count($value->children)>0) && count($order)>0) {
    215           echo $node->index.' '.$value->index."\n";
    216222          $value = $order[$value->index];
    217223        }
Note: See TracChangeset for help on using the changeset viewer.