class GraphSearch {

	public void searchBFS(GraphNode<T> root) {
		IQueue<GraphNode<T>> queue = new Queue<GraphNode<T>>();
		
		// visited root
		if (searchPathBFS.length() > 0) {
			searchPathBFS.append("->");
		}
		searchPathBFS.append(root.data.toString());
		root.visited = true;
		
		// 加到队列队尾
		queue.enqueue(root);
		
		while(!queue.isEmpty()){
			GraphNode<T> r = queue.dequeue();
			for (GraphNode<T> node : r.neighborList) {
				if (!node.visited) {
					searchPathBFS.append("->");
					searchPathBFS.append(node.data.toString());
					node.visited = true;
					
					queue.enqueue(node);
				}
			}
		}
	}

}