#ifndef HIERARCHICALNETWORK_H_
#define HIERARCHICALNETWORK_H_

#include <sstream>
#include <vector>
#include <set>
#include "include/CosiGlobal.h"
#include "include/onchipcommunication/CosiGlobal.h"
#include "networks/onchipcommunication/Specification.h"
#include "networks/onchipcommunication/PlatformInstance.h"
#include "networks/onchipcommunication/Implementation.h"
#include "networks/graph/RealWeightedGraph.h"
#include "platforms/onchipcommunication/Platform.h"
#include "io/onchipcommunication/ParquetCodeGen.h"
#include "io/onchipcommunication/HmetisInterface.h"
#include "io/onchipcommunication/PlacementParser.h"
#include "algorithms/graph/ShortestPath.h"
#include "algorithms/onchipcommunication/NetworkCost.h"


namespace cosi {

namespace algorithms {

namespace onchipcommunication {

class HierarchicalNetwork {
public:
	HierarchicalNetwork(
			cosi::commstruct::onchipcommunication::Specification* Spec,
			cosi::platforms::onchipcommunication::Platform* Plt);
	virtual ~HierarchicalNetwork();
	bool Run();
	cosi::io::onchipcommunication::PlacementParser* GetPlacement();
	cosi::commstruct::onchipcommunication::Implementation* GetImplementation();
private:
	std::vector<std::set<int> > GenerateHyperedges(cosi::commstruct::onchipcommunication::Specification* Spec) ;
	cosi::commstruct::onchipcommunication::Implementation* StarInstance(std::set<int> P, int CenterId,int Nports) ;
	cosi::commstruct::onchipcommunication::Implementation* CompleteGraph(vector<cosi::commstruct::onchipcommunication::Implementation* > I, vector<int> C);
	cosi::commstruct::onchipcommunication::Implementation* Ring(vector<cosi::commstruct::onchipcommunication::Implementation* > I, vector<int> C);
	void FindRoutes(cosi::commstruct::onchipcommunication::Implementation* I, cosi::commstruct::onchipcommunication::Specification* Spec);
	cosi::commstruct::onchipcommunication::Implementation* CleanUp(cosi::commstruct::onchipcommunication::Implementation* Net) ;
	void Floorplan(cosi::commstruct::onchipcommunication::Implementation* I) ;
	cosi::commstruct::onchipcommunication::Specification* mSpec;
	cosi::platforms::onchipcommunication::Platform* mPlt;
	cosi::commstruct::onchipcommunication::Implementation* mI;
	cosi::io::onchipcommunication::PlacementParser* mPlacement;

};

}

}

}

#endif /*HIERARCHICALNETWORK_H_*/
