Scippy

GCG

Branch-and-Price & Column Generation for Everyone

gcg::GraphGCG Class Reference

Detailed Description

Definition at line 58 of file graph_gcg.h.

#include <graph_gcg.h>

Public Member Functions

 GraphGCG ()
 
 GraphGCG (int _n_nodes, bool _undirected)
 
virtual ~GraphGCG ()
 
virtual SCIP_RETCODE addNNodes (int _n_nodes)
 
virtual SCIP_RETCODE addNNodes (int _n_nodes, std::vector< int > weights)
 
virtual int getNNodes ()
 
virtual int getNEdges ()
 
virtual std::vector< std::vector< double > > getAdjMatrix ()
 
virtual SCIP_RETCODE getEdges (std::vector< void * > &edges)
 
virtual SCIP_Bool isEdge (int node_i, int node_j)
 
virtual int getNNeighbors (int node)
 
virtual std::vector< int > getNeighbors (int node)
 
virtual std::vector< std::pair< int, double > > getNeighborWeights (int node)
 
virtual SCIP_RETCODE addNode (int node, int weight)
 
virtual SCIP_RETCODE addNode ()
 
virtual SCIP_RETCODE deleteNode (int node)
 
virtual SCIP_RETCODE addEdge (int i, int j)
 
virtual SCIP_RETCODE addEdge (int node_i, int node_j, double weight)
 
virtual SCIP_RETCODE setEdge (int node_i, int node_j, double weight)
 
virtual SCIP_RETCODE deleteEdge (int node_i, int node_j)
 
virtual int graphGetWeights (int node)
 
virtual double getEdgeWeight (int node_i, int node_j)
 
virtual int edgeComp (const EdgeGCG *a, const EdgeGCG *b)
 
virtual SCIP_RETCODE flush ()
 
virtual SCIP_RETCODE normalize ()
 
virtual double getEdgeWeightPercentile (double q)
 
- Public Member Functions inherited from gcg::Bridge
 Bridge ()
 
virtual ~Bridge ()
 
virtual SCIP_RETCODE addNNodes (int _n_nodes)=0
 
virtual SCIP_RETCODE addNNodes (int _n_nodes, std::vector< int > weights)=0
 
virtual int getNNodes ()=0
 
virtual int getNEdges ()=0
 
virtual SCIP_RETCODE getEdges (std::vector< void * > &edges)=0
 
virtual SCIP_Bool isEdge (int i, int j)=0
 
virtual int getNNeighbors (int i)=0
 
virtual std::vector< int > getNeighbors (int i)=0
 
virtual SCIP_RETCODE addNode (int i, int weight)=0
 
virtual SCIP_RETCODE addNode ()=0
 
virtual SCIP_RETCODE addEdge (int i, int j, double weight)=0
 
virtual SCIP_RETCODE setEdge (int i, int j, double weight)=0
 
virtual double getEdgeWeight (int i, int j)=0
 
virtual std::vector< std::pair< int, double > > getNeighborWeights (int i)
 
virtual SCIP_RETCODE deleteNode (int i)=0
 
virtual SCIP_RETCODE addEdge (int i, int j)=0
 
virtual SCIP_RETCODE deleteEdge (int i, int j)=0
 
virtual int graphGetWeights (int i)=0
 
virtual SCIP_RETCODE flush ()=0
 
virtual SCIP_RETCODE normalize ()=0
 
virtual double getEdgeWeightPercentile (double q)=0
 

Constructor & Destructor Documentation

◆ GraphGCG() [1/2]

gcg::GraphGCG::GraphGCG ( )

Definition at line 50 of file graph_gcg.cpp.

References NULL.

◆ GraphGCG() [2/2]

gcg::GraphGCG::GraphGCG ( int  _n_nodes,
bool  _undirected 
)

Definition at line 62 of file graph_gcg.cpp.

References NULL.

◆ ~GraphGCG()

gcg::GraphGCG::~GraphGCG ( )
virtual

Definition at line 77 of file graph_gcg.cpp.

References NULL.

Member Function Documentation

◆ addNNodes() [1/2]

SCIP_RETCODE gcg::GraphGCG::addNNodes ( int  _n_nodes)
virtual

add n nodes in the graph at the same time. it is much faster than to call addNode() many times

Implements gcg::Bridge.

Definition at line 96 of file graph_gcg.cpp.

References NULL, SCIP_ERROR, and SCIP_OKAY.

Referenced by addNNodes().

◆ addNNodes() [2/2]

SCIP_RETCODE gcg::GraphGCG::addNNodes ( int  _n_nodes,
std::vector< int >  weights 
)
virtual

add n nodes in the graph at the same time. it is much faster than to call addNode() many times. weights represent node weights

Implements gcg::Bridge.

Definition at line 120 of file graph_gcg.cpp.

References addNNodes().

◆ getNNodes()

int gcg::GraphGCG::getNNodes ( )
virtual

get number of nodes in the graph

Implements gcg::Bridge.

Definition at line 128 of file graph_gcg.cpp.

◆ getNEdges()

int gcg::GraphGCG::getNEdges ( )
virtual

get number of edges in the graph

Implements gcg::Bridge.

Definition at line 408 of file graph_gcg.cpp.

References getNNeighbors().

◆ getAdjMatrix()

vector< vector< double > > gcg::GraphGCG::getAdjMatrix ( )
virtual

Definition at line 400 of file graph_gcg.cpp.

◆ getEdges()

SCIP_RETCODE gcg::GraphGCG::getEdges ( std::vector< void * > &  edges)
virtual

get list of edges in the graph (not defined how edges are implemented)

Implements gcg::Bridge.

Definition at line 800 of file graph_gcg.cpp.

References SCIP_OKAY.

◆ isEdge()

SCIP_Bool gcg::GraphGCG::isEdge ( int  i,
int  j 
)
virtual

return whether a given pair of vertices is connected by an edge

Implements gcg::Bridge.

Definition at line 431 of file graph_gcg.cpp.

References SCIP_Bool.

Referenced by gcg::PARTIALDECOMP::reorderBlocksForStairlinkingVars().

◆ getNNeighbors()

int gcg::GraphGCG::getNNeighbors ( int  i)
virtual

get number of neighbors of a given node

Implements gcg::Bridge.

Definition at line 449 of file graph_gcg.cpp.

Referenced by getNEdges(), and gcg::PARTIALDECOMP::reorderBlocksForStairlinkingVars().

◆ getNeighbors()

vector< int > gcg::GraphGCG::getNeighbors ( int  i)
virtual

get a vector of all neighbors of a given node

Implements gcg::Bridge.

Definition at line 476 of file graph_gcg.cpp.

Referenced by gcg::PARTIALDECOMP::reorderBlocksForStairlinkingVars().

◆ getNeighborWeights()

vector< pair< int, double > > gcg::GraphGCG::getNeighborWeights ( int  node)
virtual

Reimplemented from gcg::Bridge.

Definition at line 507 of file graph_gcg.cpp.

◆ addNode() [1/2]

SCIP_RETCODE gcg::GraphGCG::addNode ( int  node,
int  weight 
)
virtual

int node is obsolete, it must be the next available id

Implements gcg::Bridge.

Definition at line 551 of file graph_gcg.cpp.

References NULL, SCIP_ERROR, and SCIP_OKAY.

◆ addNode() [2/2]

SCIP_RETCODE gcg::GraphGCG::addNode ( )
virtual

adds the node with 0 weight to the graph

Implements gcg::Bridge.

Definition at line 587 of file graph_gcg.cpp.

References addNode().

Referenced by addNode().

◆ deleteNode()

SCIP_RETCODE gcg::GraphGCG::deleteNode ( int  node)
virtual

Sets node weight to 0 and the ID to the next available.

Implements gcg::Bridge.

Definition at line 596 of file graph_gcg.cpp.

References SCIP_ERROR, and SCIP_INVALIDCALL.

◆ addEdge() [1/2]

SCIP_RETCODE gcg::GraphGCG::addEdge ( int  i,
int  j 
)
virtual

adds the edge to the graph

Implements gcg::Bridge.

Definition at line 606 of file graph_gcg.cpp.

References addEdge().

Referenced by addEdge().

◆ addEdge() [2/2]

SCIP_RETCODE gcg::GraphGCG::addEdge ( int  node_i,
int  node_j,
double  weight 
)
virtual

Sets edge weight to 1.

Implements gcg::Bridge.

Definition at line 611 of file graph_gcg.cpp.

References SCIP_ERROR, and SCIP_OKAY.

◆ setEdge()

SCIP_RETCODE gcg::GraphGCG::setEdge ( int  i,
int  j,
double  weight 
)
virtual

sets the weight of the edge in the graph

Implements gcg::Bridge.

Definition at line 658 of file graph_gcg.cpp.

References SCIP_ERROR, and SCIP_OKAY.

Referenced by deleteEdge(), and gcg::PARTIALDECOMP::reorderBlocksForStairlinkingVars().

◆ deleteEdge()

SCIP_RETCODE gcg::GraphGCG::deleteEdge ( int  i,
int  j 
)
virtual

deletes the edge from the graph

Implements gcg::Bridge.

Definition at line 695 of file graph_gcg.cpp.

References setEdge().

◆ graphGetWeights()

int gcg::GraphGCG::graphGetWeights ( int  i)
virtual

return the weight of a node

Implements gcg::Bridge.

Definition at line 700 of file graph_gcg.cpp.

◆ getEdgeWeight()

double gcg::GraphGCG::getEdgeWeight ( int  i,
int  j 
)
virtual

returns the weight of the edge in the graph

Implements gcg::Bridge.

Definition at line 705 of file graph_gcg.cpp.

Referenced by gcg::PARTIALDECOMP::reorderBlocksForStairlinkingVars().

◆ edgeComp()

int gcg::GraphGCG::edgeComp ( const EdgeGCG *  a,
const EdgeGCG *  b 
)
virtual

Definition at line 817 of file graph_gcg.cpp.

References a, and b.

◆ flush()

SCIP_RETCODE gcg::GraphGCG::flush ( )
virtual

flushes the data stuctures, if needed

Implements gcg::Bridge.

Definition at line 722 of file graph_gcg.cpp.

References SCIP_OKAY.

◆ normalize()

SCIP_RETCODE gcg::GraphGCG::normalize ( )
virtual

normalizes the edge weights, so that the biggest edge egiht in the graph is 1

Implements gcg::Bridge.

Definition at line 733 of file graph_gcg.cpp.

References max(), min(), and SCIP_OKAY.

◆ getEdgeWeightPercentile()

double gcg::GraphGCG::getEdgeWeightPercentile ( double  q)
virtual

Implements gcg::Bridge.

Definition at line 766 of file graph_gcg.cpp.