<?php
// including the class
include("graph.class.php");
// writing the graf (see graf.htm - need > IE 5) in a matrix
$m = array( // 0 1 2 3 4 5
array( 0, 5, 0, 0, 0, 7), // 0
array( 0, 0,10, 0, 0, 0), // 1
array( 0, 8, 0,11, 0, 1), // 2
array( 3, 0, 0, 0, 0, 0), // 3
array( 0, 0, 2, 0, 0, 0), // 4
array( 0, 3, 0, 0, 6, 0) // 5
);
echo "<pre>";
$test1 = new graf($m); // initializing the class
$test1 -> ways_from_point(0); // calculating all ways from point 0 to any posible point
echo "Ways from point 0 to any posible point\n";
print_r($test1 -> routs); // printing ways
$test1 -> ways_from_point_to_point(0,3); // calculating all ways from point 0 to point 3
echo "\nWays from point 0 to point 3\n";
print_r($test1 -> routs); // printing ways
$test1 -> shortest_way(0,3); // calculating shortest way from point 0 to point 3
echo "\nShortest ways from point 0 to point 3\n";
print_r($test1 -> routs); // printing ways
echo "</pre>";
// Please send your suggestions, bug reports and general feedback to dragos@protung.ro
?>
|