Example #1
0
    public function __toString()
    {
        $s = '';
        $s .= "Edge{" . str($this->v0);
        if ($this->isDirected()) {
            $s .= '->' . str($this->v1);
        } else {
            $s .= '--' . str($this->v1);
        }
        if ($this->weight !== NULL) {
            $s .= ', weight = ' . str($this->weight);
        }
        $s .= '}';
        return $s;
    }
    /**
     * Main program.
     *
     * @param array $args Command-line arguments.
     * @return integer Zero on success; non-zero on failure.
     */
    public static function main($args)
    {
        printf("Edge main program.\n");
        $status = 0;
        return $status;
    }
}
if (realpath($argv[0]) == realpath(__FILE__)) {
    exit(Edge::main(array_slice($argv, 1)));
}