$result = mysqli_query($con,"SELECT CodeCity_sou,CodeCity_des FROM bus");
while($row=mysqli_fetch_array($result))
{
if($row["CodeCity_sou"] > $row["CodeCity_des"])
{
$nodes[$i][0]=$row["CodeCity_sou"];
$nodes[$i][1]=$row["CodeCity_des"];
}
else
{
$nodes[$i][0]=$row["CodeCity_des"];
$nodes[$i][1]=$row["CodeCity_sou"];
}
$i++;
}
var_dump($nodes);
$final = array_map("unserialize", array_unique(array_map("serialize", $nodes)));
echo"
";
var_dump($final);
$counter= count($final);
for($i=0;$i<$counter;$i++)
{
$graphOfWays= array(
$final[$i][0]=> array( $final[$i][1])) ;
}
var_dump( $graphOfWays);