Detailed Description
#include <graph.h>
Public Member Functions | |
| Graph (GCG *gcgstruct) | |
| void | swap (Graph &other) |
| Graph & | operator= (Graph other) |
| virtual | ~Graph () |
| SCIP_RETCODE | addNNodes (int _n_nodes) |
| SCIP_RETCODE | addNNodes (int _n_nodes, std::vector< int > weights) |
| SCIP_RETCODE | addNode (int i, int weight) |
| SCIP_RETCODE | addNode () |
| SCIP_RETCODE | addEdge (int i, int j) |
| SCIP_RETCODE | addEdge (int i, int j, double weight) |
| SCIP_RETCODE | setEdge (int i, int j, double weight) |
| double | getEdgeWeight (int i, int j) |
| std::vector< std::pair< int, double > > | getNeighborWeights (int i) |
| int | getNNodes () |
| int | getNEdges () |
| SCIP_RETCODE | getEdges (std::vector< void * > &edges) |
| virtual int | edge (int i, int j) |
| virtual int | getNNeighbors (int i) |
| virtual std::vector< int > | getNeighbors (int i) |
| virtual void | setPartition (int i, int ID) |
| virtual SCIP_RETCODE | createFromMatrix (SCIP_CONS **conss, SCIP_VAR **vars, int nconss_, int nvars_) |
| virtual SCIP_RETCODE | writeToFile (int fd, SCIP_Bool writeweights) |
| virtual SCIP_RETCODE | readPartition (const char *filename) |
| int | getNNonzeroes () const |
| virtual int | getWeight (int i) |
| void | setDummynodes (int dummynodes_) |
| int | getDummynodes () const |
| SCIP_RETCODE | flush () |
| SCIP_RETCODE | normalize () |
| virtual double | getEdgeWeightPercentile (double q) |
Public Member Functions inherited from gcg::GraphInterface | |
| GraphInterface () | |
| virtual | ~GraphInterface () |
| virtual std::vector< int > | getPartition () const |
| virtual void | setPartition (int i, int nodeid)=0 |
| virtual SCIP_RETCODE | writeToFile (int fd, SCIP_Bool writeweights)=0 |
| virtual SCIP_RETCODE | readPartition (const char *filename)=0 |
| virtual SCIP_RETCODE | createDecompFromPartition (GCG_DECOMP **decomp) |
| virtual SCIP_RETCODE | flush ()=0 |
Data Fields | |
| std::string | name |
Protected Attributes | |
| GCG * | gcg |
| Bridge * | graph |
| int | nconss |
| int | nvars |
| int | nnonzeroes |
| int | dummynodes |
Protected Attributes inherited from gcg::GraphInterface | |
| std::vector< int > | partition |
Constructor & Destructor Documentation
◆ Graph()
| Graph::Graph | ( | GCG * | gcgstruct | ) |
Constructor
- Parameters
-
gcgstruct GCG data structure
Definition at line 47 of file graph_def.h.
References gcg::Graph< T >::graph, and NULL.
◆ ~Graph()
|
virtual |
Member Function Documentation
◆ swap()
|
inline |
Definition at line 71 of file graph.h.
References gcg::Graph< T >::dummynodes, gcg::Graph< T >::gcg, gcg::Graph< T >::graph, gcg::Graph< T >::nconss, gcg::Graph< T >::nnonzeroes, gcg::Graph< T >::nvars, and gcg::GraphInterface::partition.
Referenced by gcg::Graph< T >::operator=().
◆ operator=()
|
inline |
Definition at line 83 of file graph.h.
References gcg::Graph< T >::swap().
◆ addNNodes() [1/2]
| SCIP_RETCODE Graph::addNNodes | ( | int | _n_nodes | ) |
adds n nodes in the graph at the same time. it is much faster than to call addNode() many times
Definition at line 63 of file graph_def.h.
◆ addNNodes() [2/2]
| SCIP_RETCODE Graph::addNNodes | ( | int | _n_nodes, |
| std::vector< int > | weights | ||
| ) |
adds n nodes in the graph at the same time. it is much faster than to call addNode() many times. weights represent node weights
Definition at line 69 of file graph_def.h.
◆ addNode() [1/2]
| SCIP_RETCODE Graph::addNode | ( | int | i, |
| int | weight | ||
| ) |
adds the node with the given weight to the graph
Definition at line 91 of file graph_def.h.
◆ addNode() [2/2]
| SCIP_RETCODE Graph::addNode |
adds the node with the 0 weight to the graph
Definition at line 98 of file graph_def.h.
◆ addEdge() [1/2]
| SCIP_RETCODE Graph::addEdge | ( | int | i, |
| int | j | ||
| ) |
adds the edge to the graph
Definition at line 106 of file graph_def.h.
◆ addEdge() [2/2]
| SCIP_RETCODE Graph::addEdge | ( | int | i, |
| int | j, | ||
| double | weight | ||
| ) |
adds the weighted edge to the graph
Definition at line 251 of file graph_def.h.
◆ setEdge()
| SCIP_RETCODE Graph::setEdge | ( | int | i, |
| int | j, | ||
| double | weight | ||
| ) |
sets the weight of the edge in the graph
Definition at line 259 of file graph_def.h.
◆ getEdgeWeight()
| double Graph::getEdgeWeight | ( | int | i, |
| int | j | ||
| ) |
returns the weight of the edge in the graph
Definition at line 267 of file graph_def.h.
◆ getNeighborWeights()
| std::vector< std::pair< int, double > > Graph::getNeighborWeights | ( | int | i | ) |
Definition at line 273 of file graph_def.h.
Referenced by gcg::GraphAlgorithms< T >::dbscan(), and gcg::GraphAlgorithms< T >::expandCluster().
◆ getNNodes()
| int Graph::getNNodes |
return the number of nodes
Definition at line 75 of file graph_def.h.
Referenced by gcg::GraphAlgorithms< T >::dbscan(), gcg::GraphAlgorithms< T >::mst(), and gcg::Graph< T >::writeToFile().
◆ getNEdges()
| int Graph::getNEdges |
return the number of edges (or hyperedges)
Definition at line 80 of file graph_def.h.
Referenced by gcg::GraphAlgorithms< T >::mst(), and gcg::Graph< T >::writeToFile().
◆ getEdges()
| SCIP_RETCODE Graph::getEdges | ( | std::vector< void * > & | edges | ) |
get list of edges in the graph (not defined how edges are implemented)
Definition at line 85 of file graph_def.h.
Referenced by gcg::GraphAlgorithms< T >::mst().
◆ edge()
|
virtual |
returns whether there is an edge between nodes i and j
Definition at line 127 of file graph_def.h.
◆ getNNeighbors()
|
virtual |
return the number of neighbor nodes of given node
- Parameters
-
i the given node
Definition at line 147 of file graph_def.h.
Referenced by gcg::Graph< T >::writeToFile().
◆ getNeighbors()
|
virtual |
return the neighboring nodes of a given node
- Parameters
-
i the given node
Definition at line 153 of file graph_def.h.
Referenced by gcg::Graph< T >::writeToFile().
◆ setPartition()
|
virtual |
assigns partition to a given node
Implements gcg::GraphInterface.
Definition at line 160 of file graph_def.h.
References partition().
◆ createFromMatrix()
|
inlinevirtual |
create graph from the matrix, to be overriden by the implementation
- Parameters
-
conss constraints for which graph should be created vars variables for which graph should be created nconss_ number of constraints nvars_ number of variables
Definition at line 146 of file graph.h.
References SCIP_ERROR.
◆ writeToFile()
|
virtual |
writes the graph to the given file. The format is graph dependent
write the graph to a file
- Parameters
-
fd filename where the graph should be written to writeweights whether to write weights
Implements gcg::GraphInterface.
Definition at line 167 of file graph_def.h.
References GCGgetOrigprob(), gcg::Graph< T >::getNEdges(), gcg::Graph< T >::getNeighbors(), gcg::Graph< T >::getNNeighbors(), gcg::Graph< T >::getNNodes(), nnodes, NULL, SCIP_FILECREATEERROR, SCIP_OKAY, and SCIPinfoMessage().
◆ readPartition()
|
virtual |
reads the partition from the given file. The format is graph dependent. The default is a file with one line for each node a
read in the partition from a file
- Parameters
-
filename filename where the partition is stored
Implements gcg::GraphInterface.
Definition at line 213 of file graph_def.h.
References partition(), SCIP_OKAY, SCIP_READERROR, and SCIPerrorMessage.
◆ getNNonzeroes()
|
inline |
Definition at line 170 of file graph.h.
References gcg::Graph< T >::nnonzeroes.
◆ getWeight()
|
virtual |
return the weight of given node
- Parameters
-
i the given node
Definition at line 241 of file graph_def.h.
◆ setDummynodes()
|
inline |
set the number of dummy nodes
Definition at line 181 of file graph.h.
References gcg::Graph< T >::dummynodes.
◆ getDummynodes()
|
inline |
Definition at line 186 of file graph.h.
References gcg::Graph< T >::dummynodes.
◆ flush()
|
virtual |
Implements gcg::GraphInterface.
Definition at line 113 of file graph_def.h.
◆ normalize()
| SCIP_RETCODE Graph::normalize |
Definition at line 120 of file graph_def.h.
◆ getEdgeWeightPercentile()
|
virtual |
Definition at line 280 of file graph_def.h.
Field Documentation
◆ name
| std::string gcg::Graph< T >::name |
◆ gcg
|
protected |
Definition at line 58 of file graph.h.
Referenced by gcg::Graph< T >::swap().
◆ graph
|
protected |
Definition at line 59 of file graph.h.
Referenced by gcg::Graph< T >::Graph(), and gcg::Graph< T >::swap().
◆ nconss
|
protected |
Definition at line 60 of file graph.h.
Referenced by gcg::Graph< T >::swap().
◆ nvars
|
protected |
Definition at line 61 of file graph.h.
Referenced by gcg::Graph< T >::swap().
◆ nnonzeroes
|
protected |
Definition at line 62 of file graph.h.
Referenced by gcg::Graph< T >::getNNonzeroes(), and gcg::Graph< T >::swap().
◆ dummynodes
|
protected |
Definition at line 63 of file graph.h.
Referenced by gcg::Graph< T >::getDummynodes(), gcg::Graph< T >::setDummynodes(), and gcg::Graph< T >::swap().
Public Member Functions inherited from