#ifndef GCG_HYPERGRAPH_H_
#define GCG_HYPERGRAPH_H_
#include "objscip/objscip.h"
#include "tclique/tclique.h"
#include "weights.h"
#include "pub_decomp.h"
#include "graph.h"
#include "graph_interface.h"
#include <exception>
#include <vector>
#include <string>
namespace gcg {
template <class T>
class Hypergraph : public GraphInterface {
public:
std::string name;
protected:
SCIP* scip_;
Graph<T>* graph;
std::vector<int> nodes;
std::vector<int> hedges;
std::vector<int> mapping;
int lastnode;
int dummynodes;
public:
Hypergraph(
SCIP* scip
);
void swap(Hypergraph & other) {
std::swap(partition, other.partition);
std::swap(scip_ , other.scip_);
std::swap(graph , other.graph);
std::swap(hedges , other.hedges);
std::swap(nodes , other.nodes);
std::swap(lastnode, other.lastnode);
std::swap(dummynodes, other.dummynodes);
}
Hypergraph& operator=(Hypergraph other) {
swap(other);
return *this;
}
~Hypergraph();
SCIP_RETCODE addNode(int i,int weight);
SCIP_RETCODE addHyperedge(std::vector<int> &edge, int weight);
SCIP_RETCODE addNodeToHyperedge(int node, int hedge);
int getNNodes();
int getNHyperedges();
int getNNeighbors(
int i
);
std::vector<int> getNeighbors(
int i
);
std::vector<int> getHyperedgeNodes(
int i
);
int getNHyperedgeNodes(
int i
);
void setPartition(int i, int ID);
SCIP_RETCODE writeToFile(
int fd,
SCIP_Bool writeweights
);
SCIP_RETCODE readPartition(
const char* filename
);
int getWeight(
int i
);
int getHyperedgeWeight(
int i
);
void setDummynodes(int dummynodes_)
{
dummynodes = dummynodes_;
}
int getDummynodes() const
{
return dummynodes;
}
SCIP_RETCODE flush();
private:
int computeNodeId(int i);
};
}
#endif