Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions

ColPack::BipartiteGraphBicoloring Class Reference
[Classes for Bipartite Graphs BiColoring]

class BipartiteGraphBicoloring in group22. More...

#include <BipartiteGraphBicoloring.h>

Inherits ColPack::BipartiteGraphOrdering.

Inherited by ColPack::BipartiteGraphBicoloringInterface.

Collaboration diagram for ColPack::BipartiteGraphBicoloring:
Collaboration graph
[legend]

List of all members.

Public Member Functions

void GetLeftVertexColors (vector< int > &output)
 Get the color IDs for the left vertices (rows). Color IDs start from 1, color ID 0 should be ignored.
void GetRightVertexColors (vector< int > &output)
 Get the color IDs for the right vertices (columns). Color IDs start from (# of rows + 1), color ID (# of rows + # of columns + 1) should be ignored.
void GetRightVertexColors_Transformed (vector< int > &output)
 Get the color IDs for the right vertices (columns) in the format similar to GetLeftVertexColor(). Color IDs start from 1, color ID 0 should be ignored.
double ** GetLeftSeedMatrix (int *ip1_SeedRowCount, int *ip1_SeedColumnCount)
 Generate and return the Left Seed matrix. This Seed matrix is managed and freed by ColPack.
double ** GetLeftSeedMatrix_unmanaged (int *ip1_SeedRowCount, int *ip1_SeedColumnCount)
 Same as GetLeftSeedMatrix(), except that this Seed matrix is NOT managed by ColPack.
double ** GetRightSeedMatrix (int *ip1_SeedRowCount, int *ip1_SeedColumnCount)
 Return the Right Seed matrix. This Seed matrix is managed and freed by ColPack.
double ** GetRightSeedMatrix_unmanaged (int *ip1_SeedRowCount, int *ip1_SeedColumnCount)
 Same as GetRightSeedMatrix(), except that this Seed matrix is NOT managed by ColPack.
void GetSeedMatrix (double ***dp3_LeftSeed, int *ip1_LeftSeedRowCount, int *ip1_LeftSeedColumnCount, double ***dp3_RightSeed, int *ip1_RightSeedRowCount, int *ip1_RightSeedColumnCount)
 Return both the Left and Right Seed matrix. These Seed matrices are managed and freed by ColPack.
void GetSeedMatrix_unmanaged (double ***dp3_LeftSeed, int *ip1_LeftSeedRowCount, int *ip1_LeftSeedColumnCount, double ***dp3_RightSeed, int *ip1_RightSeedRowCount, int *ip1_RightSeedColumnCount)
 Same as GetSeedMatrix(), except that These Seed matrices are NOT managed by ColPack.
 BipartiteGraphBicoloring ()
 ~BipartiteGraphBicoloring ()
virtual void Clear ()
virtual void Reset ()
int ImplicitCoveringStarBicoloring ()
int ExplicitCoveringStarBicoloring ()
int ExplicitCoveringModifiedStarBicoloring ()
int ImplicitCoveringGreedyStarBicoloring ()
int MinimalCoveringRowMajorStarBicoloring ()
int MinimalCoveringColumnMajorStarBicoloring ()
int ImplicitCoveringConservativeStarBicoloring ()
int MinimalCoveringStarBicoloring ()
int ImplicitCoveringRestrictedStarBicoloring ()
int CheckStarBicoloring ()
int GetLeftVertexColorCount ()
int GetRightVertexColorCount ()
int GetVertexColorCount ()
int GetViolationCount ()
int GetRightVertexDefaultColor ()
string GetVertexBicoloringVariant ()
void PrintVertexBicolors ()
void PrintVertexBicoloringMetrics ()
void PrintVertexBicolorClasses ()
double GetVertexColoringTime ()

Protected Member Functions

void Seed_init ()
void Seed_reset ()

Protected Attributes

int i_LeftVertexDefaultColor
 Whether or not color 0 is used for left vertices.
int i_RightVertexDefaultColor
 Whether or not color 0 is used for right vertices.
int m_i_LeftVertexColorCount
 The number of colors used to color Left Vertices.
int m_i_RightVertexColorCount
 The number of colors used to color Right Vertices.
int m_i_VertexColorCount
vector< int > m_vi_LeftVertexColors
 The color IDs used to color the left vertices (rows).
vector< int > m_vi_RightVertexColors
 The color IDs used to color the right vertices (columns).
bool lseed_available
int i_lseed_rowCount
double ** dp2_lSeed
bool rseed_available
int i_rseed_rowCount
double ** dp2_rSeed
int m_i_ViolationCount
int m_i_LargestLeftVertexColorClass
int m_i_LargestRightVertexColorClass
int m_i_LargestLeftVertexColorClassSize
int m_i_LargestRightVertexColorClassSize
int m_i_SmallestLeftVertexColorClass
int m_i_SmallestRightVertexColorClass
int m_i_SmallestLeftVertexColorClassSize
int m_i_SmallestRightVertexColorClassSize
int m_i_LargestVertexColorClass
int m_i_SmallestVertexColorClass
int m_i_LargestVertexColorClassSize
int m_i_SmallestVertexColorClassSize
double m_d_AverageLeftVertexColorClassSize
double m_d_AverageRightVertexColorClassSize
double m_d_AverageVertexColorClassSize
double m_d_ColoringTime
double m_d_CheckingTime
string m_s_VertexColoringVariant
vector< int > m_vi_LeftVertexColorFrequency
vector< int > m_vi_RightVertexColorFrequency

Private Member Functions

void PresetCoveredVertexColors ()
int CheckVertexColoring (string s_VertexColoringVariant)
int CalculateVertexColorClasses ()
int FixMinimalCoverStarBicoloring ()

Detailed Description

class BipartiteGraphBicoloring in group22.

Bipartite graph bicoloring is an assignment of colors to subsets of column and row vertices of the bipartite graph of a Jacobian matrix. The present version of ColPack provides methods for star bicoloring only. The distance-one coloring constraint is satisfied by all bicoloring algorithms by selecting colors for row and column vertices from two disjoint sets of colors. Sizes of the sets are equal to the number of row and column vertices respectively, which are the maximum number of colors that can be required by the row or column vertices.

In star bicoloring, vertex cover can be computed either explicitly or implicitly. An explicit vertex cover is computed and used to determine which vertices are to be colored. An implicit vertex cover is computed by including vertices as they get colored, into the cover and is used to determine the end of coloring as a vertex cover is reached. In both cases pre-computed vertex ordering determines the order in which vertices are colored. In implicit vertex cover, a vertex is not selected as a candidate vertex to be colored if no edge is incident on the vertex which has not been covered by any other colored vertex.

Definition at line 46 of file BipartiteGraphBicoloring.h.


Constructor & Destructor Documentation

ColPack::BipartiteGraphBicoloring::BipartiteGraphBicoloring (  ) 

Definition at line 352 of file BipartiteGraphBicoloring.cpp.

References Clear(), and Seed_init().

Here is the call graph for this function:

ColPack::BipartiteGraphBicoloring::~BipartiteGraphBicoloring (  ) 

Definition at line 361 of file BipartiteGraphBicoloring.cpp.

References Clear(), and Seed_reset().

Here is the call graph for this function:


Member Function Documentation

int ColPack::BipartiteGraphBicoloring::CalculateVertexColorClasses (  )  [private]
int ColPack::BipartiteGraphBicoloring::CheckStarBicoloring (  ) 
int ColPack::BipartiteGraphBicoloring::CheckVertexColoring ( string  s_VertexColoringVariant  )  [private]
void ColPack::BipartiteGraphBicoloring::Clear (  )  [virtual]
int ColPack::BipartiteGraphBicoloring::ExplicitCoveringModifiedStarBicoloring (  ) 
int ColPack::BipartiteGraphBicoloring::ExplicitCoveringStarBicoloring (  ) 
int ColPack::BipartiteGraphBicoloring::FixMinimalCoverStarBicoloring (  )  [private]
double ** ColPack::BipartiteGraphBicoloring::GetLeftSeedMatrix ( int *  ip1_SeedRowCount,
int *  ip1_SeedColumnCount 
)

Generate and return the Left Seed matrix. This Seed matrix is managed and freed by ColPack.

Precondition:

  • the Graph has been Bicolored

Postcondition:

  • Size of the returned matrix is (*ip1_SeedRowCount) rows x (*ip1_SeedColumnCount) columns. (*ip1_SeedColumnCount) == num of rows of the original matrix == GetRowVertexCount() (*ip1_SeedRowCount) == num of colors used to color the left (row) vertices excluding color 0.

Notes:

  • Vertices with color 0 are ignored. That also means left (row) vertices with color 1 will be grouped together into the first row (row 0) of the seed matrix and so on.

Reimplemented in ColPack::BipartiteGraphBicoloringInterface.

Definition at line 5445 of file BipartiteGraphBicoloring.cpp.

References dp2_lSeed, ColPack::BipartiteGraphCore::GetLeftVertexCount(), i_LeftVertexDefaultColor, i_lseed_rowCount, lseed_available, m_i_LeftVertexColorCount, m_vi_LeftVertexColors, and Seed_reset().

Referenced by GetSeedMatrix().

Here is the call graph for this function:

Here is the caller graph for this function:

double ** ColPack::BipartiteGraphBicoloring::GetLeftSeedMatrix_unmanaged ( int *  ip1_SeedRowCount,
int *  ip1_SeedColumnCount 
)

Same as GetLeftSeedMatrix(), except that this Seed matrix is NOT managed by ColPack.

Notes:

  • This Seed matrix is NOT managed by ColPack. Therefore, the user should free the Seed matrix manually when the matrix is no longer needed.

Definition at line 5530 of file BipartiteGraphBicoloring.cpp.

References ColPack::BipartiteGraphCore::GetLeftVertexCount(), i_LeftVertexDefaultColor, m_i_LeftVertexColorCount, and m_vi_LeftVertexColors.

Referenced by ColPack::BipartiteGraphBicoloringInterface::GenerateSeedJacobian_unmanaged(), and GetSeedMatrix_unmanaged().

Here is the call graph for this function:

Here is the caller graph for this function:

int ColPack::BipartiteGraphBicoloring::GetLeftVertexColorCount (  ) 

Definition at line 5199 of file BipartiteGraphBicoloring.cpp.

References m_i_LeftVertexColorCount.

Referenced by toFileBiC().

Here is the caller graph for this function:

void ColPack::BipartiteGraphBicoloring::GetLeftVertexColors ( vector< int > &  output  ) 

Get the color IDs for the left vertices (rows). Color IDs start from 1, color ID 0 should be ignored.

Definition at line 5290 of file BipartiteGraphBicoloring.cpp.

References m_vi_LeftVertexColors.

Referenced by ColPack::JacobianRecovery2D::DirectRecover_CoordinateFormat(), ColPack::JacobianRecovery2D::DirectRecover_RowCompressedFormat(), ColPack::JacobianRecovery2D::DirectRecover_SparseSolversFormat(), and main().

Here is the caller graph for this function:

double ** ColPack::BipartiteGraphBicoloring::GetRightSeedMatrix ( int *  ip1_SeedRowCount,
int *  ip1_SeedColumnCount 
)

Return the Right Seed matrix. This Seed matrix is managed and freed by ColPack.

Precondition:

  • the Graph has been Bicolored

Postcondition:

  • Size of the returned matrix is (*ip1_SeedRowCount) rows x (*ip1_SeedColumnCount) columns. (*ip1_SeedRowCount) == num of columns of the original matrix == GetColumnVertexCount() (*ip1_SeedColumnCount) == num of colors used to color the right (column) vertices excluding color 0.

Notes:

  • Vertices with color 0 are ignored. That also means right (column) vertices with color 1 will be grouped together into the first column (column 0) of the seed matrix and so on.

Reimplemented in ColPack::BipartiteGraphBicoloringInterface.

Definition at line 5487 of file BipartiteGraphBicoloring.cpp.

References dp2_rSeed, GetRightVertexColors_Transformed(), ColPack::BipartiteGraphCore::GetRightVertexCount(), i_RightVertexDefaultColor, i_rseed_rowCount, m_i_RightVertexColorCount, rseed_available, and Seed_reset().

Referenced by GetSeedMatrix().

Here is the call graph for this function:

Here is the caller graph for this function:

double ** ColPack::BipartiteGraphBicoloring::GetRightSeedMatrix_unmanaged ( int *  ip1_SeedRowCount,
int *  ip1_SeedColumnCount 
)

Same as GetRightSeedMatrix(), except that this Seed matrix is NOT managed by ColPack.

Notes:

  • This Seed matrix is NOT managed by ColPack. Therefore, the user should free the Seed matrix manually when the matrix is no longer needed.

Definition at line 5566 of file BipartiteGraphBicoloring.cpp.

References GetRightVertexColors_Transformed(), ColPack::BipartiteGraphCore::GetRightVertexCount(), i_RightVertexDefaultColor, and m_i_RightVertexColorCount.

Referenced by ColPack::BipartiteGraphBicoloringInterface::GenerateSeedJacobian_unmanaged(), and GetSeedMatrix_unmanaged().

Here is the call graph for this function:

Here is the caller graph for this function:

int ColPack::BipartiteGraphBicoloring::GetRightVertexColorCount (  ) 
void ColPack::BipartiteGraphBicoloring::GetRightVertexColors ( vector< int > &  output  ) 

Get the color IDs for the right vertices (columns). Color IDs start from (# of rows + 1), color ID (# of rows + # of columns + 1) should be ignored.

Definition at line 5297 of file BipartiteGraphBicoloring.cpp.

References m_vi_RightVertexColors.

Referenced by main().

Here is the caller graph for this function:

void ColPack::BipartiteGraphBicoloring::GetRightVertexColors_Transformed ( vector< int > &  output  ) 

Get the color IDs for the right vertices (columns) in the format similar to GetLeftVertexColor(). Color IDs start from 1, color ID 0 should be ignored.

Definition at line 5302 of file BipartiteGraphBicoloring.cpp.

References ColPack::BipartiteGraphCore::GetColumnVertexCount(), ColPack::BipartiteGraphCore::GetRowVertexCount(), and m_vi_RightVertexColors.

Referenced by ColPack::JacobianRecovery2D::DirectRecover_CoordinateFormat(), ColPack::JacobianRecovery2D::DirectRecover_RowCompressedFormat(), ColPack::JacobianRecovery2D::DirectRecover_SparseSolversFormat(), GetRightSeedMatrix(), and GetRightSeedMatrix_unmanaged().

Here is the call graph for this function:

Here is the caller graph for this function:

int ColPack::BipartiteGraphBicoloring::GetRightVertexDefaultColor (  ) 
void ColPack::BipartiteGraphBicoloring::GetSeedMatrix ( double ***  dp3_LeftSeed,
int *  ip1_LeftSeedRowCount,
int *  ip1_LeftSeedColumnCount,
double ***  dp3_RightSeed,
int *  ip1_RightSeedRowCount,
int *  ip1_RightSeedColumnCount 
)

Return both the Left and Right Seed matrix. These Seed matrices are managed and freed by ColPack.

Notes:

  • These Seed matrices are NOT managed by ColPack. Therefore, the user should free the Seed matrices manually when the matrices are no longer needed.

Definition at line 5607 of file BipartiteGraphBicoloring.cpp.

References GetLeftSeedMatrix(), and GetRightSeedMatrix().

Here is the call graph for this function:

void ColPack::BipartiteGraphBicoloring::GetSeedMatrix_unmanaged ( double ***  dp3_LeftSeed,
int *  ip1_LeftSeedRowCount,
int *  ip1_LeftSeedColumnCount,
double ***  dp3_RightSeed,
int *  ip1_RightSeedRowCount,
int *  ip1_RightSeedColumnCount 
)

Same as GetSeedMatrix(), except that These Seed matrices are NOT managed by ColPack.

Notes:

  • These Seed matrices are NOT managed by ColPack. Therefore, the user should free the Seed matrices manually when the matrices are no longer needed.

Definition at line 5612 of file BipartiteGraphBicoloring.cpp.

References GetLeftSeedMatrix_unmanaged(), and GetRightSeedMatrix_unmanaged().

Here is the call graph for this function:

string ColPack::BipartiteGraphBicoloring::GetVertexBicoloringVariant (  ) 

Definition at line 5231 of file BipartiteGraphBicoloring.cpp.

References m_s_VertexColoringVariant.

Referenced by PrintVertexBicoloringMetrics(), and PrintVertexBicolors().

Here is the caller graph for this function:

int ColPack::BipartiteGraphBicoloring::GetVertexColorCount (  ) 

Definition at line 5212 of file BipartiteGraphBicoloring.cpp.

References m_i_VertexColorCount.

Referenced by toFileBiC().

Here is the caller graph for this function:

double ColPack::BipartiteGraphBicoloring::GetVertexColoringTime (  ) 

Definition at line 5603 of file BipartiteGraphBicoloring.cpp.

References m_d_ColoringTime.

Referenced by toFileBiC().

Here is the caller graph for this function:

int ColPack::BipartiteGraphBicoloring::GetViolationCount (  ) 

Definition at line 5219 of file BipartiteGraphBicoloring.cpp.

References m_i_ViolationCount.

int ColPack::BipartiteGraphBicoloring::ImplicitCoveringConservativeStarBicoloring (  ) 
int ColPack::BipartiteGraphBicoloring::ImplicitCoveringGreedyStarBicoloring (  ) 
int ColPack::BipartiteGraphBicoloring::ImplicitCoveringRestrictedStarBicoloring (  ) 
int ColPack::BipartiteGraphBicoloring::ImplicitCoveringStarBicoloring (  ) 
int ColPack::BipartiteGraphBicoloring::MinimalCoveringColumnMajorStarBicoloring (  ) 
int ColPack::BipartiteGraphBicoloring::MinimalCoveringRowMajorStarBicoloring (  ) 
int ColPack::BipartiteGraphBicoloring::MinimalCoveringStarBicoloring (  ) 
void ColPack::BipartiteGraphBicoloring::PresetCoveredVertexColors (  )  [private]
void ColPack::BipartiteGraphBicoloring::PrintVertexBicolorClasses (  ) 
void ColPack::BipartiteGraphBicoloring::PrintVertexBicoloringMetrics (  ) 
void ColPack::BipartiteGraphBicoloring::PrintVertexBicolors (  ) 
void ColPack::BipartiteGraphBicoloring::Reset (  )  [virtual]
void ColPack::BipartiteGraphBicoloring::Seed_init (  )  [protected]

Definition at line 368 of file BipartiteGraphBicoloring.cpp.

References dp2_lSeed, dp2_rSeed, i_lseed_rowCount, i_rseed_rowCount, lseed_available, and rseed_available.

Referenced by BipartiteGraphBicoloring().

Here is the caller graph for this function:

void ColPack::BipartiteGraphBicoloring::Seed_reset (  )  [protected]

Member Data Documentation

Definition at line 158 of file BipartiteGraphBicoloring.h.

Referenced by GetLeftSeedMatrix(), Seed_init(), and Seed_reset().

Definition at line 162 of file BipartiteGraphBicoloring.h.

Referenced by GetRightSeedMatrix(), Seed_init(), and Seed_reset().

Definition at line 157 of file BipartiteGraphBicoloring.h.

Referenced by GetLeftSeedMatrix(), Seed_init(), and Seed_reset().

Definition at line 161 of file BipartiteGraphBicoloring.h.

Referenced by GetRightSeedMatrix(), Seed_init(), and Seed_reset().

Definition at line 156 of file BipartiteGraphBicoloring.h.

Referenced by GetLeftSeedMatrix(), Seed_init(), and Seed_reset().

Definition at line 210 of file BipartiteGraphBicoloring.h.

Referenced by Clear(), and Reset().

Definition at line 160 of file BipartiteGraphBicoloring.h.

Referenced by GetRightSeedMatrix(), Seed_init(), and Seed_reset().