GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
gcg::Hypergraph< T > Class Template Reference

Detailed Description

template<class T>
class gcg::Hypergraph< T >

Definition at line 55 of file hypergraph.h.

#include <hypergraph.h>

Public Member Functions

 Hypergraph (GCG *gcgstruct)
void swap (Hypergraph &other)
Hypergraph & operator= (Hypergraph other)
 ~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_)
int getDummynodes () const
SCIP_RETCODE flush ()
Public Member Functions inherited from gcg::GraphInterface
 GraphInterface ()
virtual ~GraphInterface ()
virtual std::vector< int > getPartition () const
virtual SCIP_RETCODE createDecompFromPartition (GCG_DECOMP **decomp)

Data Fields

std::string name

Protected Attributes

GCG * gcg
Graph< T > * graph
std::vector< int > nodes
std::vector< int > hedges
std::vector< int > mapping
int lastnode
int dummynodes
Protected Attributes inherited from gcg::GraphInterface
std::vector< int > partition

Constructor & Destructor Documentation

◆ Hypergraph()

template<class T>
gcg::Hypergraph< T >::Hypergraph ( GCG * gcgstruct)

Constructor

Parameters
gcgstructGCG data structure

Definition at line 46 of file hypergraph_def.h.

References dummynodes, graph, lastnode, name, and SCIPdebugMessage().

Referenced by operator=(), and swap().

◆ ~Hypergraph()

template<class T>
gcg::Hypergraph< T >::~Hypergraph ( )

Destruktor

Definition at line 55 of file hypergraph_def.h.

References graph.

Member Function Documentation

◆ swap()

template<class T>
void gcg::Hypergraph< T >::swap ( Hypergraph< T > & other)
inline

Definition at line 73 of file hypergraph.h.

References dummynodes, gcg, graph, hedges, Hypergraph(), lastnode, nodes, and gcg::GraphInterface::partition.

Referenced by operator=().

◆ operator=()

template<class T>
Hypergraph & gcg::Hypergraph< T >::operator= ( Hypergraph< T > other)
inline

Definition at line 85 of file hypergraph.h.

References Hypergraph(), and swap().

◆ addNode()

template<class T>
SCIP_RETCODE gcg::Hypergraph< T >::addNode ( int i,
int weight )

adds the node with the given weight to the graph

Definition at line 76 of file hypergraph_def.h.

References graph, i, lastnode, mapping, nodes, SCIP_CALL(), and SCIPdebugMessage().

◆ addHyperedge()

template<class T>
SCIP_RETCODE gcg::Hypergraph< T >::addHyperedge ( std::vector< int > & edge,
int weight )

adds the edge to the graph

Definition at line 90 of file hypergraph_def.h.

References graph, hedges, i, lastnode, mapping, SCIP_CALL(), and SCIPdebugMessage().

◆ addNodeToHyperedge()

template<class T>
SCIP_RETCODE gcg::Hypergraph< T >::addNodeToHyperedge ( int node,
int hedge )

adds the edge to the graph

Definition at line 109 of file hypergraph_def.h.

References graph, hedges, nodes, and SCIP_CALL().

◆ getNNodes()

template<class T>
int gcg::Hypergraph< T >::getNNodes ( )

return the number of nodes

Definition at line 120 of file hypergraph_def.h.

References nodes.

Referenced by readPartition(), and setPartition().

◆ getNHyperedges()

template<class T>
int gcg::Hypergraph< T >::getNHyperedges ( )

return the number of edges (or hyperedges)

Definition at line 125 of file hypergraph_def.h.

References hedges.

Referenced by gcg::GraphAlgorithms< T >::computekMetric(), gcg::GraphAlgorithms< T >::computeMincut(), and gcg::GraphAlgorithms< T >::computeSoed().

◆ getNNeighbors()

template<class T>
int gcg::Hypergraph< T >::getNNeighbors ( int i)

return the number of neighbor nodes of given node

Parameters
ithe given node

Definition at line 130 of file hypergraph_def.h.

References assert(), graph, and i.

◆ getNeighbors()

template<class T>
std::vector< int > gcg::Hypergraph< T >::getNeighbors ( int i)

return the neighboring nodes of a given node

Parameters
ithe given node

Definition at line 136 of file hypergraph_def.h.

References assert(), graph, i, j, and mapping.

Referenced by gcg::HypercolGraph< T >::getNeighbors(), and gcg::HyperrowGraph< T >::getNeighbors().

◆ getHyperedgeNodes()

template<class T>
std::vector< int > gcg::Hypergraph< T >::getHyperedgeNodes ( int i)

return the nodes spanned by hyperedge

Definition at line 158 of file hypergraph_def.h.

References graph, hedges, i, and j.

Referenced by gcg::GraphAlgorithms< T >::computekMetric(), gcg::GraphAlgorithms< T >::computeMincut(), and gcg::GraphAlgorithms< T >::computeSoed().

◆ getNHyperedgeNodes()

template<class T>
int gcg::Hypergraph< T >::getNHyperedgeNodes ( int i)

return the number of nodes spanned by hyperedge

Definition at line 171 of file hypergraph_def.h.

References graph, hedges, and i.

◆ setPartition()

template<class T>
void gcg::Hypergraph< T >::setPartition ( int i,
int ID )
virtual

assigns partition to a given node

Implements gcg::GraphInterface.

Definition at line 179 of file hypergraph_def.h.

References getNNodes(), i, and gcg::GraphInterface::partition.

◆ writeToFile()

template<class T>
SCIP_RETCODE gcg::Hypergraph< T >::writeToFile ( int fd,
SCIP_Bool writeweights )
virtual

writes the hypergraph to the given file. The format is hypergraph dependent

write the hypergraph to a file

Parameters
fdfilename where the graph should be written to
writeweightswhether to write weights

Implements gcg::GraphInterface.

Definition at line 186 of file hypergraph_def.h.

References dummynodes, GCGgetOrigprob(), graph, hedges, i, j, and nodes.

◆ readPartition()

template<class T>
SCIP_RETCODE gcg::Hypergraph< T >::readPartition ( const char * filename)
virtual

reads the partition from the given file. The format is hypergraph dependent. The default is a file with one line for each node a

read in the partition from a file

Parameters
filenamefilename where the partition is stored

Implements gcg::GraphInterface.

Definition at line 220 of file hypergraph_def.h.

References getNNodes(), i, and gcg::GraphInterface::partition.

Referenced by gcg::HypercolGraph< T >::readPartition(), and gcg::HyperrowGraph< T >::readPartition().

◆ getWeight()

template<class T>
int gcg::Hypergraph< T >::getWeight ( int i)

return the weight of given node

Parameters
ithe given node

Definition at line 248 of file hypergraph_def.h.

References graph, and i.

◆ getHyperedgeWeight()

template<class T>
int gcg::Hypergraph< T >::getHyperedgeWeight ( int i)

return the weight of given hyperedge

Parameters
ithe given hyperedge

Definition at line 257 of file hypergraph_def.h.

References graph, hedges, and i.

Referenced by gcg::GraphAlgorithms< T >::computekMetric(), gcg::GraphAlgorithms< T >::computeMincut(), and gcg::GraphAlgorithms< T >::computeSoed().

◆ setDummynodes()

template<class T>
void gcg::Hypergraph< T >::setDummynodes ( int dummynodes_)
inline

set the number of dummy nodes

Definition at line 161 of file hypergraph.h.

References dummynodes.

◆ getDummynodes()

template<class T>
int gcg::Hypergraph< T >::getDummynodes ( ) const
inline

Definition at line 167 of file hypergraph.h.

References dummynodes.

◆ flush()

template<class T>
SCIP_RETCODE gcg::Hypergraph< T >::flush ( )
virtual

Implements gcg::GraphInterface.

Definition at line 267 of file hypergraph_def.h.

References graph, and SCIP_CALL().

Field Documentation

◆ name

template<class T>
std::string gcg::Hypergraph< T >::name

Definition at line 57 of file hypergraph.h.

Referenced by Hypergraph().

◆ gcg

template<class T>
GCG* gcg::Hypergraph< T >::gcg
protected

Definition at line 59 of file hypergraph.h.

Referenced by swap().

◆ graph

◆ nodes

template<class T>
std::vector<int> gcg::Hypergraph< T >::nodes
protected

Definition at line 61 of file hypergraph.h.

Referenced by addNode(), addNodeToHyperedge(), getNNodes(), swap(), and writeToFile().

◆ hedges

template<class T>
std::vector<int> gcg::Hypergraph< T >::hedges
protected

◆ mapping

template<class T>
std::vector<int> gcg::Hypergraph< T >::mapping
protected

Definition at line 63 of file hypergraph.h.

Referenced by addHyperedge(), addNode(), and getNeighbors().

◆ lastnode

template<class T>
int gcg::Hypergraph< T >::lastnode
protected

Definition at line 64 of file hypergraph.h.

Referenced by addHyperedge(), addNode(), Hypergraph(), and swap().

◆ dummynodes

template<class T>
int gcg::Hypergraph< T >::dummynodes
protected

Definition at line 65 of file hypergraph.h.

Referenced by getDummynodes(), Hypergraph(), setDummynodes(), swap(), and writeToFile().