public function __construct($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = PIE_LEFT, $top = PIE_TOP) { parent::__construct($bgw, $bgh, $left, $top); // サイズ設定 $this->setSize(PIE_WIDTH, PIE_HEIGHT, PIE_THICK); // 位置設定 $this->setPosition($this->left + $this->cw / 2, $this->top + $this->ch / 2); }
/** * Main program. * * @param array $args Command-line arguments. * @return integer Zero on success; non-zero on failure. */ public static function main($args) { printf("GraphAsLists main program.\n"); $status = 0; $g = new GraphAsLists(4); AbstractGraph::test($g); $g->purge(); AbstractGraph::testWeighted($g); $g->purge(); return $status; }
public function __construct($bgw = BG_WIDTH, $bgh = BG_HEIGHT, $left = LINE_LEFT, $top = LINE_TOP, $area_width = LINE_AREA_WIDTH, $area_height = LINE_AREA_HEIGHT) { parent::__construct($bgw, $bgh, $left, $top); $this->area_width = $area_width; $this->area_height = $area_height; $this->ygrid_on = true; $this->line_max = 0; $this->graph_max = 0; $this->XLabelAngle = 0; $this->x_margin = 0; $this->y_margin = 0; }
$g->addVertex(1, box(234)); $g->addVertex(2, box(345)); $g->addEdge(0, 1, box(3)); $g->addEdge(0, 2, box(1)); $g->addEdge(1, 2, box(4)); printf("%s\n", str($g)); printf("Using vertex iterator\n"); foreach ($g->getVertices() as $v) { printf("%s\n", str($v)); } printf("Using edge iterator\n"); foreach ($g->getEdges() as $e) { printf("%s\n", str($e)); } } /** * Main program. * * @param array $args Command-line arguments. * @return integer Zero on success; non-zero on failure. */ public static function main($args) { printf("AbstractGraph main program.\n"); $status = 0; return $status; } } if (realpath($argv[0]) == realpath(__FILE__)) { exit(AbstractGraph::main(array_slice($argv, 1))); }
/** * Weighted graph test method. * * @param object IDigraph $g The weighted graph to test. */ public static function testWeighted(IDigraph $g) { printf("Weighted digraph test program.\n"); AbstractGraph::testWeighted($g); }