Why is the graph missing the edges with vertex

i have never construct a graph ,didn’t know how it work ,but i tried to constrcut it manually it work well

but i can’t add it with do untill
when i tried to construct like this it miss the edges in vertex .
i don’t really know how the graph work ,so any suggest?
graph class : minecraft-GPS/graph.class.ps1 at module · CN-CODEGOD/minecraft-GPS · GitHub

. $PSScriptRoot\gps.class.ps1
. $PSScriptRoot\graph.class.ps1
. $PSScriptRoot\bellman-ford.ps1


function graph {
    param (
        
        [place]$myplace
        ,
        [place]$destination
        ,
        [dimension]$dimension

    )
    
$roads=import-xml $PSScriptRoot\xml\roads.xml|Where-Object {$_.dimension -like $dimension}
$destination.id="P"
$graph = New-Object Graph
$roadsqueue= New-Object System.Collections.Generic.Queue[object]
$roadsqueue.enqueue($myplace)
foreach ($road in $roads) { 
    $roadsqueue.enqueue($road)

}

$roadsqueue.enqueue($destination)

    
do {
    $dequeue=$roadsqueue.dequeue()
    $startvertex = new-object vertex $dequeue
  $roadsqueue.ForEach(
   {
   
   $weight=[road]::calcroute($dequeue,$_)
   
   $endvertex =new-object vertex $_
   $newedge = [edge]::new($startvertex,$endvertex,$weight)

   $graph.addedge($newedge)

   }

  )
   
    
} until (
$roadsqueue.Count -eq 0
)
  
    
  
    $graph
}

c:> $graph.edges.Values.startvertex

value edges
----- -----
place {edge, edge, edge, edge鈥
place {edge, edge, edge, edge鈥
place {edge, edge, edge, edge鈥
place {edge, edge, edge, edge鈥
place {edge, edge, edge, edge鈥
road  {}
road  {}
road  {}
road  {}
road  {}
road  {}
road  {}
road  {}
road  {}
road  {}