gcg::Hypergraph< T > Class Template Reference

Detailed Description

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

Definition at line 54 of file hypergraph.h.

#include <hypergraph.h>

Public Member Functions

 Hypergraph (SCIP *scip)
 
void swap (Hypergraph &other)
 
Hypergraphoperator= (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 (DEC_DECOMP **decomp)
 

Public Attributes

std::string name
 

Protected Attributes

SCIP * scip_
 
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

template<class T >
gcg::Hypergraph< T >::Hypergraph ( SCIP *  scip)

Constructor

Parameters
scipSCIP data structure

Definition at line 45 of file hypergraph_def.h.

References gcg::Hypergraph< T >::graph.

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

Member Function Documentation

template<class T >
SCIP_RETCODE gcg::Hypergraph< T >::addHyperedge ( std::vector< int > &  edge,
int  weight 
)
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 75 of file hypergraph_def.h.

References gcg::Hypergraph< T >::graph, gcg::Hypergraph< T >::lastnode, gcg::Hypergraph< T >::mapping, and gcg::Hypergraph< T >::nodes.

Referenced by gcg::Hypergraph< T >::operator=().

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

adds the edge to the graph

Definition at line 108 of file hypergraph_def.h.

References gcg::Hypergraph< T >::graph, gcg::Hypergraph< T >::hedges, and gcg::Hypergraph< T >::nodes.

Referenced by gcg::Hypergraph< T >::operator=().

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

Implements gcg::GraphInterface.

Definition at line 265 of file hypergraph_def.h.

References gcg::Hypergraph< T >::graph.

Referenced by gcg::Hypergraph< T >::getDummynodes().

template<class T>
int gcg::Hypergraph< T >::getDummynodes ( ) const
inline
template<class T >
std::vector< int > gcg::Hypergraph< T >::getHyperedgeNodes ( int  i)
template<class T >
int gcg::Hypergraph< T >::getHyperedgeWeight ( int  i)
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 135 of file hypergraph_def.h.

References gcg::Hypergraph< T >::graph, and gcg::Hypergraph< T >::mapping.

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

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

return the number of nodes spanned by hyperedge

Definition at line 170 of file hypergraph_def.h.

References gcg::Hypergraph< T >::graph, and gcg::Hypergraph< T >::hedges.

Referenced by gcg::Hypergraph< T >::operator=().

template<class T >
int gcg::Hypergraph< T >::getNHyperedges ( )
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 129 of file hypergraph_def.h.

References gcg::Hypergraph< T >::graph.

Referenced by gcg::Hypergraph< T >::operator=().

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

return the weight of given node

Parameters
ithe given node

Definition at line 246 of file hypergraph_def.h.

References gcg::Hypergraph< T >::graph.

Referenced by gcg::Hypergraph< T >::operator=().

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 218 of file hypergraph_def.h.

References gcg::Hypergraph< T >::getNNodes(), and gcg::GraphInterface::partition.

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

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

set the number of dummy nodes

Definition at line 160 of file hypergraph.h.

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 178 of file hypergraph_def.h.

References gcg::Hypergraph< T >::getNNodes(), and gcg::GraphInterface::partition.

Referenced by gcg::Hypergraph< T >::operator=().

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 185 of file hypergraph_def.h.

References gcg::Hypergraph< T >::dummynodes, gcg::Hypergraph< T >::graph, gcg::Hypergraph< T >::hedges, gcg::Hypergraph< T >::nodes, and gcg::Hypergraph< T >::scip_.

Referenced by gcg::Hypergraph< T >::operator=().

Member Data Documentation

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

Definition at line 56 of file hypergraph.h.

template<class T>
SCIP* gcg::Hypergraph< T >::scip_
protected

Definition at line 58 of file hypergraph.h.

Referenced by gcg::Hypergraph< T >::swap(), and gcg::Hypergraph< T >::writeToFile().