赞
踩
void unWeightedShortestPath(Graph G,int s){ LLQueue q = new LLQueue(); int v,w; q.enQueue(s); for(int i = 0;i<G.vertexCount;i++){ Distance[i] = -1; } Distance[s] = 0; while(!q.isEmpty()){ v = q.deQueue(); for(int j = 0;j< G.vertexcount;j++){ if(adjMatrix[v][j] == 1){ Distance[w] = Distance[v] + 1; Path[w] = v; q.enQueue(w); } } } q.deleteQueue(); }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。