[jgrapht-users] Breadth First Search?
Brought to you by:
barak_naveh,
perfecthash
From: Filip I. <dj...@gm...> - 2007-03-12 08:54:44
|
Hello, Im new to JGraphT and it seems like a great API. I was wondering if someone could direct me to a breadth first iteration example? Specifically, what I need to do is split a graph into n subgraphs equally. For example, I have a graph that resembles a square box with many evenly connected boxes (vertices) inside it. I would like to iterate through in a breadth first manor, adding an even split of the number of vertices into each of the n subgraphs. I want to essentially evenly distribute connected vertices based on a total vertex count / number of subgraphs with a breadth first iteration. This may be a stupid question and as easy as just calling the iterator's next function, but Im just curious if I need to use the encounterNextVertex(), encoutnerVertexAgain() and isConnectedComponentExhausted() or if can just simply do this: BreadthFirstIterator<UndirectedWeightedGraph<int, DefaultWeightedEdge>> bf = new...... while (!bf.isConnectedComponentExhausted()) { vertex v = provideNextVertex(); set.add(v); } Thanks for the help. Filip |