//************************************************************
// This program goes through the vertices and returns the Sequence of
// vertices with the specified placement.
//**************************************************************
#include <LINK/basic/SortedArray.h>
#include <LINK/userobj/PostAnalyze.h>


Set<Vertex*>
PlacedPartitions(Graph *g, int place)
{
	int tmp=0;
	Set<Vertex*> result;
	if (!g) return result;

	int location;
	int placed;
	int count = 0;
	Vertex* v;
	const SortedArray<Vertex*> vertices = g->vertices();

	Iterator<Vertex*> traverse_vertices(&vertices);


	while (traverse_vertices(v))
	{
		getAttribute((GraphObject*) v, "placed", placed);
		if (place == UNPLACED) {
			if (placed == 0)	
				result.insert(v);
		} else {
			getAttribute((GraphObject*) v, "partition", location);
			if (place == LEFT && location == 0)
				result.insert(v);
			else if (place == RIGHT && location == 1)
				result.insert(v);
		}
	}
	return result;
}
