广度优先遍历思路:
还是以之前深度优先遍历的图为例,如下:
A B C D E F G H
A[0, 1, 0, 0, 0, 1, 0, 1]
B[1, 0, 1, 0, 0, 0,..., 1, 0, 0, 0, 1, 0]
F[1, 0, 0, 0, 0, 0, 1, 0]
G[0, 1, 0, 0, 1, 1, 0, 0]
H[1, 0, 0, 1, 0, 0, 0, 0]
所谓广度优先...,就类似二叉树的层序遍历,先搞完第一行,搞完第一行搞下一行。...顶点1
* @param vertex2
* 顶点2
* @param isConnected
* 顶点1和顶点...findNeighborByPriorNeighbor(currentVertex, neighborVetex);
}
}
}
}
/**
* 广度优先遍历