37 #ifndef GCG_GRAPH_DEF_H_
38 #define GCG_GRAPH_DEF_H_
40 #include "scip/scip.h"
48 ) : name(
"graph"),scip_(scip),graph(NULL),nconss(0),nvars(0),nnonzeroes(0),dummynodes(0)
64 return graph->addNNodes(_n_nodes);
70 return graph->addNNodes(_n_nodes, weights);
75 return graph->getNNodes();
80 return graph->getNEdges();
86 return graph->getEdges(edges);
92 SCIP_CALL( graph->addNode(i, weight) );
99 SCIP_CALL( graph->addNode() );
107 SCIP_CALL( graph->addEdge(i, j) );
114 SCIP_CALL( graph->flush() );
121 SCIP_CALL( graph->normalize() );
131 std::vector<int> Neighbors;
133 Neighbors = getNeighbors(i);
134 for(
int k=0; k<(int)Neighbors.size(); k++)
136 if(Neighbors[k] == j)
139 k = (int)Neighbors.size();
148 return graph->getNNeighbors(i);
155 return graph->getNeighbors(i);
168 SCIP_Bool writeweights
174 file = fdopen(fd,
"wx");
176 return SCIP_FILECREATEERROR;
181 SCIPinfoMessage(scip_, file,
"%d %d\n", nnodes+dummynodes, nedges/2);
183 for(
int i = 0; i < nnodes; ++i )
192 for(
int j = 0; j < nneighbors; ++j )
194 SCIPinfoMessage(scip_, file,
"%d ", neighbors[j]+1);
196 SCIPinfoMessage(scip_, file,
"\n");
199 for(
int i = 0; i < dummynodes; ++i )
201 SCIPinfoMessage(scip_, file,
"\n");
214 ifstream input(filename);
217 SCIPerrorMessage(
"Could not open file <%s> for reading\n", filename);
218 return SCIP_READERROR;
221 for(
int i = 0; i < getNNodes(); ++i )
224 if( !(input >> part) )
226 SCIPerrorMessage(
"Could not read from file <%s>. It may be in the wrong format\n", filename);
227 return SCIP_READERROR;
242 return graph->graphGetWeights(i);
250 SCIP_CALL( graph->addEdge(i, j, weight) );
258 SCIP_CALL( graph->setEdge(i, j, weight) );
266 return graph->getEdgeWeight(i, j);
272 return graph->getNeighborWeights(i);
279 return graph->getEdgeWeightPercentile(q);
289 graph->expand(factor);
293 void Graph<T>::inflate(
double factor)
295 graph->inflate(factor);
299 void Graph<T>::colL1Norm()
305 void Graph<T>::prune()
311 bool Graph<T>::stopMCL(
int iter)
313 return graph->stopMCL(iter);
317 std::vector<int> Graph<T>::getClustersMCL()
319 return graph->getClustersMCL();
324 void Graph<T>::initMCL()
330 void Graph<T>::clearMCL()