Detailed Description
#include <graph.h>
Public Member Functions | |
Graph (SCIP *scip) | |
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 SCIP_RETCODE | createDecompFromPartition (DEC_DECOMP **decomp) |
Data Fields | |
std::string | name |
Protected Attributes | |
SCIP * | scip_ |
Bridge * | graph |
int | nconss |
int | nvars |
int | nnonzeroes |
int | dummynodes |
Protected Attributes inherited from gcg::GraphInterface | |
std::vector< int > | partition |
Constructor & Destructor Documentation
◆ Graph()
gcg::Graph< T >::Graph | ( | SCIP * | scip | ) |
Constructor
- Parameters
-
scip SCIP data structure
Definition at line 46 of file graph_def.h.
References gcg::Graph< T >::graph.
◆ ~Graph()
|
virtual |
Destruktor
Definition at line 54 of file graph_def.h.
Member Function Documentation
◆ swap()
|
inline |
Definition at line 70 of file graph.h.
References gcg::Graph< T >::dummynodes, gcg::Graph< T >::graph, gcg::Graph< T >::nconss, gcg::Graph< T >::nnonzeroes, gcg::Graph< T >::nvars, gcg::GraphInterface::partition, and gcg::Graph< T >::scip_.
Referenced by gcg::Graph< T >::operator=().
◆ operator=()
|
inline |
Definition at line 82 of file graph.h.
References gcg::Graph< T >::swap().
◆ addNNodes() [1/2]
SCIP_RETCODE gcg::Graph< T >::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 62 of file graph_def.h.
◆ addNNodes() [2/2]
SCIP_RETCODE gcg::Graph< T >::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 68 of file graph_def.h.
◆ addNode() [1/2]
SCIP_RETCODE gcg::Graph< T >::addNode | ( | int | i, |
int | weight | ||
) |
adds the node with the given weight to the graph
Definition at line 90 of file graph_def.h.
◆ addNode() [2/2]
SCIP_RETCODE gcg::Graph< T >::addNode |
adds the node with the 0 weight to the graph
Definition at line 97 of file graph_def.h.
◆ addEdge() [1/2]
SCIP_RETCODE gcg::Graph< T >::addEdge | ( | int | i, |
int | j | ||
) |
adds the edge to the graph
Definition at line 105 of file graph_def.h.
◆ addEdge() [2/2]
SCIP_RETCODE gcg::Graph< T >::addEdge | ( | int | i, |
int | j, | ||
double | weight | ||
) |
adds the weighted edge to the graph
Definition at line 248 of file graph_def.h.
◆ setEdge()
SCIP_RETCODE gcg::Graph< T >::setEdge | ( | int | i, |
int | j, | ||
double | weight | ||
) |
sets the weight of the edge in the graph
Definition at line 256 of file graph_def.h.
◆ getEdgeWeight()
double gcg::Graph< T >::getEdgeWeight | ( | int | i, |
int | j | ||
) |
returns the weight of the edge in the graph
Definition at line 264 of file graph_def.h.
◆ getNeighborWeights()
std::vector< std::pair< int, double > > gcg::Graph< T >::getNeighborWeights | ( | int | i | ) |
Definition at line 270 of file graph_def.h.
Referenced by gcg::GraphAlgorithms< T >::dbscan(), and gcg::GraphAlgorithms< T >::expandCluster().
◆ getNNodes()
int gcg::Graph< T >::getNNodes |
return the number of nodes
Definition at line 74 of file graph_def.h.
Referenced by gcg::GraphAlgorithms< T >::dbscan(), gcg::GraphAlgorithms< T >::mst(), and gcg::Graph< T >::writeToFile().
◆ getNEdges()
int gcg::Graph< T >::getNEdges |
return the number of edges (or hyperedges)
Definition at line 79 of file graph_def.h.
Referenced by gcg::GraphAlgorithms< T >::mst(), and gcg::Graph< T >::writeToFile().
◆ getEdges()
SCIP_RETCODE gcg::Graph< T >::getEdges | ( | std::vector< void * > & | edges | ) |
get list of edges in the graph (not defined how edges are implemented)
Definition at line 84 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 126 of file graph_def.h.
◆ getNNeighbors()
|
virtual |
return the number of neighbor nodes of given node
- Parameters
-
i the given node
Definition at line 146 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 152 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 159 of file graph_def.h.
References partition().
◆ createFromMatrix()
|
inlinevirtual |
◆ 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 166 of file graph_def.h.
References gcg::Graph< T >::getNEdges(), gcg::Graph< T >::getNeighbors(), gcg::Graph< T >::getNNeighbors(), and gcg::Graph< T >::getNNodes().
◆ 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 210 of file graph_def.h.
References partition().
◆ getNNonzeroes()
|
inline |
Definition at line 169 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 238 of file graph_def.h.
◆ setDummynodes()
|
inline |
set the number of dummy nodes
Definition at line 180 of file graph.h.
References gcg::Graph< T >::dummynodes.
◆ getDummynodes()
|
inline |
Definition at line 185 of file graph.h.
References gcg::Graph< T >::dummynodes.
◆ flush()
|
virtual |
Implements gcg::GraphInterface.
Definition at line 112 of file graph_def.h.
◆ normalize()
SCIP_RETCODE gcg::Graph< T >::normalize |
Definition at line 119 of file graph_def.h.
◆ getEdgeWeightPercentile()
|
virtual |
Definition at line 277 of file graph_def.h.
Field Documentation
◆ name
std::string gcg::Graph< T >::name |
◆ scip_
|
protected |
Definition at line 57 of file graph.h.
Referenced by gcg::Graph< T >::swap().
◆ graph
|
protected |
Definition at line 58 of file graph.h.
Referenced by gcg::Graph< T >::Graph(), and gcg::Graph< T >::swap().
◆ nconss
|
protected |
Definition at line 59 of file graph.h.
Referenced by gcg::Graph< T >::swap().
◆ nvars
|
protected |
Definition at line 60 of file graph.h.
Referenced by gcg::Graph< T >::swap().
◆ nnonzeroes
|
protected |
Definition at line 61 of file graph.h.
Referenced by gcg::Graph< T >::getNNonzeroes(), and gcg::Graph< T >::swap().
◆ dummynodes
|
protected |
Definition at line 62 of file graph.h.
Referenced by gcg::Graph< T >::getDummynodes(), gcg::Graph< T >::setDummynodes(), and gcg::Graph< T >::swap().