implement BFS for AdjancyMatrixUGraph