ProjectionNode Class Reference

#include <ProjectionNode.hh>

List of all members.

Public Member Functions

 ProjectionNode (int *theEdge, vector< int > *theDeletedNodes, vector< int * > *theDeletedEdges, vector< int * > *theFalseEdges, ProjectionNode *prevNode)
 ~ProjectionNode ()
ProjectionNodeaddNode (int theEdge[2], vector< int > *theDeletedNodes, vector< int * > *theDeletedEdges, vector< int * > *theFalseEdges)
int getEdge (int i)
vector< int > * getDeletedNodes ()
vector< int * > * getDeletedEdges ()
vector< int * > * getFalseEdges ()
ProjectionNodegetPreviousNode ()


Detailed Description

This class represents a node of the tree needed for the edge projection.

Definition at line 34 of file ProjectionNode.hh.


Constructor & Destructor Documentation

ProjectionNode::ProjectionNode int *  theEdge,
vector< int > *  theDeletedNodes,
vector< int * > *  theDeletedEdges,
vector< int * > *  theFalseEdges,
ProjectionNode prevNode
 

Constructor.

Parameters:
theEdge Projection edge.
*theDeletedNodes Pointer to the nodes which are deleted.
*theDeletedEdges Pointer to the edges whcih are deleted.
*theFalseEdges pointer to the false edges.
*prevNode Pointer to the previous node of the tree.

Definition at line 35 of file ProjectionNode.cpp.

Referenced by addNode().

00038                                                         :
00039     previousNode(prevNode)
00040 {
00041     
00042     int i;    // Loop variable.
00043     int size; // Store a size.
00044 
00045     //
00046     // Copy projection edge.            
00047     //
00048     edge[0] = theEdge[0];
00049     edge[1] = theEdge[1];
00050 
00051     //
00052     // Copy the deleted nodes.
00053     //
00054     if (theDeletedNodes != NULL) {
00055         if(!theDeletedNodes->empty()) {
00056         size = theDeletedNodes->size();
00057         deletedNodes.resize(size);
00058         for (i=0; i<size; i++) {
00059             deletedNodes[i] = (*theDeletedNodes)[i];
00060         }}
00061     }// if
00062     
00063     //
00064     // Copy the deleted edges.
00065     //
00066     if (!theDeletedEdges->empty()) {
00067         int *anEdge;
00068         size = theDeletedEdges->size();
00069         deletedEdges.resize(size);
00070         for (i=0; i<size; i++) {
00071             anEdge = new int[2];
00072             anEdge[0] = (*theDeletedEdges)[i][0];
00073             anEdge[1] = (*theDeletedEdges)[i][1];
00074             deletedEdges[i] = anEdge;
00075         }
00076     }// if
00077     
00078     //
00079     // Copy the false edges.
00080     //
00081     if (!theFalseEdges->empty()) {
00082         int *anEdge;
00083         size = theFalseEdges->size();
00084         falseEdges.resize(size);
00085         for (i=0; i<size; i++) {
00086             anEdge = new int[2];
00087             anEdge[0] = (*theFalseEdges)[i][0];
00088             anEdge[1] = (*theFalseEdges)[i][1];
00089             falseEdges[i] = anEdge;
00090         }
00091     }// if
00092     
00093 }// end constructor

ProjectionNode::~ProjectionNode  ) 
 

Destructor

Definition at line 99 of file ProjectionNode.cpp.

00099                                 {
00100 
00101     // Delete all edges.
00102     if (!deletedEdges.empty()) {
00103         for (int i=deletedEdges.size()-1; i>=0; i--) {
00104             delete [] deletedEdges[i];
00105             deletedEdges[i] = NULL;
00106         }
00107         deletedEdges.clear();
00108     }
00109     // Delete all false edges.
00110     if (!falseEdges.empty()) {
00111         for (int i=falseEdges.size()-1; i>=0; i--) {
00112             delete [] falseEdges[i];
00113             falseEdges[i] = NULL;
00114         }
00115         falseEdges.clear();
00116     }
00117     // Delete all sons of this node.
00118     if (!itsNodes.empty()) {
00119         for (int i=itsNodes.size()-1; i>=0; i--) {
00120             // Call destructor of each son of this node.
00121             delete itsNodes[i];
00122             itsNodes[i] = NULL;
00123         }
00124         itsNodes.clear();
00125     }
00126 
00127 }// end destructor


Member Function Documentation

ProjectionNode * ProjectionNode::addNode int  theEdge[2],
vector< int > *  theDeletedNodes,
vector< int * > *  theDeletedEdges,
vector< int * > *  theFalseEdges
 

Add new node to the tree.

Parameters:
theEdge Projection edge.
*theDeletedNodes Pointer to the nodes which are deleted.
*theDeletedEdges Pointer to the edges whcih are deleted.
*theFalseEdges pointer to the false edges.
Returns:
Pointer to the new node of the tree.

Definition at line 133 of file ProjectionNode.cpp.

References ProjectionNode().

00136                                                                      {
00137     
00138     ProjectionNode *pN;
00139     pN = new ProjectionNode(theEdge, theDeletedNodes, theDeletedEdges,
00140                             theFalseEdges, this);
00141     itsNodes.push_back(pN);  
00142     
00143     return pN;
00144 }

vector< int * > * ProjectionNode::getDeletedEdges  ) 
 

Get all deleted edges.

Parameters:
void 
Returns:
Pointer to a vector storing the edges which have been deleted.

Definition at line 166 of file ProjectionNode.cpp.

00166                                               {    
00167     return &deletedEdges;
00168 }

vector< int > * ProjectionNode::getDeletedNodes  ) 
 

Get all deleted nodes.

Parameters:
void 
Returns:
Pointer to a vector storing the nodes which have been deleted.

Definition at line 158 of file ProjectionNode.cpp.

00158                                              {  
00159     return &deletedNodes;
00160 }

int ProjectionNode::getEdge int  i  ) 
 

Get an endnode of the projection edge.

Parameters:
i Index of the node.
Returns:
On endnode of the edge.

Definition at line 150 of file ProjectionNode.cpp.

00150                                  {
00151     return edge[i];
00152 }

vector< int * > * ProjectionNode::getFalseEdges  ) 
 

Get all false edges.

Parameters:
void 
Returns:
Pointer to a vector storing the false edges.

Definition at line 174 of file ProjectionNode.cpp.

00174                                             {    
00175     return &falseEdges;
00176 }

ProjectionNode * ProjectionNode::getPreviousNode  ) 
 

Get previous node in the tree.

Parameters:
void 
Returns:
Pointer to the previous node of the tree.

Definition at line 182 of file ProjectionNode.cpp.

00182                                                 {    
00183     return previousNode;
00184 }


The documentation for this class was generated from the following files:
Generated on Fri Apr 28 15:50:00 2006 for Branch and Cut algorithm for the Maximum Stable Set Problem by  doxygen 1.4.6-NO