class BipartiteGraphInputOutput in group2. More...
#include <BipartiteGraphInputOutput.h>
Inherits ColPack::BipartiteGraphCore.
Inherited by ColPack::BipartiteGraphPartialOrdering, and ColPack::BipartiteGraphVertexCover.
Public Member Functions | |
int | ReadBipartiteGraph (string s_InputFile, string s_fileFormat="AUTO_DETECTED") |
Read the sparsity pattern of a matrix in the specified file format from the specified filename and build a Bipartite Graph. | |
int | BuildBPGraphFromRowCompressedFormat (unsigned int **uip2_JacobianSparsityPattern, int i_RowCount, int i_ColumnCount) |
Read the sparsity pattern of Jacobian matrix represented in ADOLC format (Row Compressed format) and build a corresponding adjacency graph. | |
int | RowCompressedFormat2BipartiteGraph (unsigned int **uip2_JacobianSparsityPattern, int i_RowCount, int i_ColumnCount) |
Given a compressed sparse row representation, build the corresponding bipartite graph representation. | |
int | BipartiteGraph2RowCompressedFormat (unsigned int ***uip3_JacobianSparsityPattern, unsigned int *uip1_RowCount, unsigned int *uip1_ColumnCount) |
Given a bipartite graph representation, build the corresponding compressed sparse row representation. | |
int | ReadGenericMatrixBipartiteGraph (string s_InputFile) |
Read a file with explicit 1 and 0 representing sparsity structure and build corresponding bipartite graph. | |
int | ReadGenericSquareMatrixBipartiteGraph (string s_InputFile) |
Read a file with explicit 1 and 0 representing sparsity sturcture of a square matrix whose order is specified in the extension of the filename and build a Bipartite Graph. | |
BipartiteGraphInputOutput () | |
~BipartiteGraphInputOutput () | |
virtual void | Initialize () |
virtual void | Clear () |
int | ReadMatrixMarketBipartiteGraph (string s_InputFile) |
Read sparsity pattern of a matrix specified in Matrix Market format from a file and build a corresponding bipartite graph. | |
int | ReadMeTiSBipartiteGraph (string s_InputFile) |
Read sparsity pattern of a matrix specified in MeTiS format from a file and build a corresponding bipartite graph. | |
int | ReadHarwellBoeingBipartiteGraph (string s_InputFile) |
Read sparsity pattern of a matrix specified in Harwell Boeing format from a file and build a corresponding bipartite graph. | |
void | PrintBipartiteGraph () |
void | PrintVertexDegrees () |
Private Member Functions | |
void | CalculateVertexDegrees () |
class BipartiteGraphInputOutput in group2.
BipartiteGraphInputOutput class provides the input methods for reading in matrix or graph files in supported formats for generating bipartite graphs. Three input formats are supported by default - Matrix Market, Harwell Boeing and MeTiS. This class is similar to the GraphInputOutput class discussed in Section 2.1 in functionalities with the difference that it stores bipartite graphs in CES scheme.
Definition at line 36 of file BipartiteGraphInputOutput.h.
ColPack::BipartiteGraphInputOutput::BipartiteGraphInputOutput | ( | ) |
Definition at line 90 of file BipartiteGraphInputOutput.cpp.
References Clear().
ColPack::BipartiteGraphInputOutput::~BipartiteGraphInputOutput | ( | ) |
Definition at line 96 of file BipartiteGraphInputOutput.cpp.
References Clear().
int ColPack::BipartiteGraphInputOutput::BipartiteGraph2RowCompressedFormat | ( | unsigned int *** | uip3_JacobianSparsityPattern, | |
unsigned int * | uip1_RowCount, | |||
unsigned int * | uip1_ColumnCount | |||
) |
Given a bipartite graph representation, build the corresponding compressed sparse row representation.
Postcondition:
Return value:
Definition at line 952 of file BipartiteGraphInputOutput.cpp.
References ColPack::BipartiteGraphCore::GetColumnVertexCount(), ColPack::BipartiteGraphCore::GetRowVertexCount(), ColPack::BipartiteGraphCore::m_vi_Edges, and ColPack::BipartiteGraphCore::m_vi_LeftVertices.
int ColPack::BipartiteGraphInputOutput::BuildBPGraphFromRowCompressedFormat | ( | unsigned int ** | uip2_JacobianSparsityPattern, | |
int | i_RowCount, | |||
int | i_ColumnCount | |||
) |
Read the sparsity pattern of Jacobian matrix represented in ADOLC format (Row Compressed format) and build a corresponding adjacency graph.
Equivalent to RowCompressedFormat2BipartiteGraph Precondition:
Return value:
Definition at line 909 of file BipartiteGraphInputOutput.cpp.
References RowCompressedFormat2BipartiteGraph().
Referenced by ColPack::BipartiteGraphBicoloringInterface::BipartiteGraphBicoloringInterface(), and ColPack::BipartiteGraphPartialColoringInterface::BipartiteGraphPartialColoringInterface().
void ColPack::BipartiteGraphInputOutput::CalculateVertexDegrees | ( | ) | [private] |
Definition at line 28 of file BipartiteGraphInputOutput.cpp.
References _UNKNOWN, ColPack::BipartiteGraphCore::m_d_AverageLeftVertexDegree, ColPack::BipartiteGraphCore::m_d_AverageRightVertexDegree, ColPack::BipartiteGraphCore::m_d_AverageVertexDegree, ColPack::BipartiteGraphCore::m_i_MaximumLeftVertexDegree, ColPack::BipartiteGraphCore::m_i_MaximumRightVertexDegree, ColPack::BipartiteGraphCore::m_i_MaximumVertexDegree, ColPack::BipartiteGraphCore::m_i_MinimumLeftVertexDegree, ColPack::BipartiteGraphCore::m_i_MinimumRightVertexDegree, ColPack::BipartiteGraphCore::m_i_MinimumVertexDegree, ColPack::BipartiteGraphCore::m_vi_Edges, ColPack::BipartiteGraphCore::m_vi_LeftVertices, ColPack::BipartiteGraphCore::m_vi_RightVertices, and STEP_DOWN.
Referenced by ReadGenericMatrixBipartiteGraph(), ReadGenericSquareMatrixBipartiteGraph(), ReadHarwellBoeingBipartiteGraph(), ReadMatrixMarketBipartiteGraph(), ReadMeTiSBipartiteGraph(), and RowCompressedFormat2BipartiteGraph().
void ColPack::BipartiteGraphInputOutput::Clear | ( | ) | [virtual] |
Reimplemented from ColPack::BipartiteGraphCore.
Reimplemented in ColPack::BipartiteGraphBicoloring, ColPack::BipartiteGraphBicoloringInterface, ColPack::BipartiteGraphOrdering, ColPack::BipartiteGraphVertexCover, ColPack::BipartiteGraphPartialColoring, ColPack::BipartiteGraphPartialColoringInterface, and ColPack::BipartiteGraphPartialOrdering.
Definition at line 108 of file BipartiteGraphInputOutput.cpp.
Referenced by BipartiteGraphInputOutput(), ReadGenericMatrixBipartiteGraph(), ReadGenericSquareMatrixBipartiteGraph(), ReadHarwellBoeingBipartiteGraph(), ReadMatrixMarketBipartiteGraph(), ReadMeTiSBipartiteGraph(), and ~BipartiteGraphInputOutput().
void ColPack::BipartiteGraphInputOutput::Initialize | ( | ) | [virtual] |
Implements ColPack::BipartiteGraphCore.
Definition at line 102 of file BipartiteGraphInputOutput.cpp.
void ColPack::BipartiteGraphInputOutput::PrintBipartiteGraph | ( | ) |
Definition at line 809 of file BipartiteGraphInputOutput.cpp.
References ColPack::BipartiteGraphCore::m_s_InputFile, ColPack::BipartiteGraphCore::m_vi_Edges, ColPack::BipartiteGraphCore::m_vi_LeftVertices, ColPack::BipartiteGraphCore::m_vi_RightVertices, STEP_DOWN, and STEP_UP.
Referenced by main().
void ColPack::BipartiteGraphInputOutput::PrintVertexDegrees | ( | ) |
Definition at line 890 of file BipartiteGraphInputOutput.cpp.
References ColPack::BipartiteGraphCore::m_d_AverageLeftVertexDegree, ColPack::BipartiteGraphCore::m_d_AverageRightVertexDegree, ColPack::BipartiteGraphCore::m_d_AverageVertexDegree, ColPack::BipartiteGraphCore::m_i_MaximumLeftVertexDegree, ColPack::BipartiteGraphCore::m_i_MaximumRightVertexDegree, ColPack::BipartiteGraphCore::m_i_MaximumVertexDegree, ColPack::BipartiteGraphCore::m_i_MinimumLeftVertexDegree, ColPack::BipartiteGraphCore::m_i_MinimumRightVertexDegree, ColPack::BipartiteGraphCore::m_i_MinimumVertexDegree, and ColPack::BipartiteGraphCore::m_s_InputFile.
int ColPack::BipartiteGraphInputOutput::ReadBipartiteGraph | ( | string | s_InputFile, | |
string | s_fileFormat = "AUTO_DETECTED" | |||
) |
Read the sparsity pattern of a matrix in the specified file format from the specified filename and build a Bipartite Graph.
This function will
About input parameters:
Definition at line 980 of file BipartiteGraphInputOutput.cpp.
References _TRUE, ColPack::File::GetFileExtension(), ColPack::isHarwellBoeingFormat(), ColPack::isMatrixMarketFormat(), ColPack::isMeTiSFormat(), ReadGenericMatrixBipartiteGraph(), ReadGenericSquareMatrixBipartiteGraph(), ReadHarwellBoeingBipartiteGraph(), ReadMatrixMarketBipartiteGraph(), and ReadMeTiSBipartiteGraph().
Referenced by ColPack::BipartiteGraphBicoloringInterface::BipartiteGraphBicoloringInterface(), and ColPack::BipartiteGraphPartialColoringInterface::BipartiteGraphPartialColoringInterface().
int ColPack::BipartiteGraphInputOutput::ReadGenericMatrixBipartiteGraph | ( | string | s_InputFile | ) |
Read a file with explicit 1 and 0 representing sparsity structure and build corresponding bipartite graph.
The format of the matrix is specified bellow (this file format .gen is NOT the same as the .gen2 files used by ReadGenericSquareMatrixBipartiteGraph() ):
Example: testmatrix-5by5.gen
1 1 1 0 1 0 1 0 1 0
0 1 0 1 0 1 0 1 0 1
1 0 1 1 1 0 1 0 1 0
0 1 0 1 0 1 0 1 0 1
1 0 1 0 1 1 1 0 1 0
0 1 0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 1 1 0
0 1 0 1 0 1 0 1 0 1
1 0 1 0 1 0 1 0 1 1
0 1 0 1 0 1 0 1 0 1
Definition at line 604 of file BipartiteGraphInputOutput.cpp.
References _TRUE, CalculateVertexDegrees(), Clear(), ColPack::BipartiteGraphCore::m_s_InputFile, ColPack::BipartiteGraphCore::m_vi_Edges, ColPack::BipartiteGraphCore::m_vi_LeftVertices, and ColPack::BipartiteGraphCore::m_vi_RightVertices.
Referenced by ReadBipartiteGraph().
int ColPack::BipartiteGraphInputOutput::ReadGenericSquareMatrixBipartiteGraph | ( | string | s_InputFile | ) |
Read a file with explicit 1 and 0 representing sparsity sturcture of a square matrix whose order is specified in the extension of the filename and build a Bipartite Graph.
The format of the matrix is specified bellow (this file format .gen2 is NOT the same as the .gen files used by ReadGenericMatrixBipartiteGraph() ):
Example: testmatrix-12by10.gens (because the min is 10 => real size: 10x10)
11101010100101010101101110101001010101011010111010
01010101011010101110010101010110101010110101010101
Definition at line 710 of file BipartiteGraphInputOutput.cpp.
References _TRUE, CalculateVertexDegrees(), Clear(), ColPack::BipartiteGraphCore::m_s_InputFile, ColPack::BipartiteGraphCore::m_vi_Edges, ColPack::BipartiteGraphCore::m_vi_LeftVertices, and ColPack::BipartiteGraphCore::m_vi_RightVertices.
Referenced by ReadBipartiteGraph().
int ColPack::BipartiteGraphInputOutput::ReadHarwellBoeingBipartiteGraph | ( | string | s_InputFile | ) |
Read sparsity pattern of a matrix specified in Harwell Boeing format from a file and build a corresponding bipartite graph.
Definition at line 473 of file BipartiteGraphInputOutput.cpp.
References _TRUE, CalculateVertexDegrees(), Clear(), ColPack::BipartiteGraphCore::m_s_InputFile, ColPack::BipartiteGraphCore::m_vi_Edges, ColPack::BipartiteGraphCore::m_vi_LeftVertices, and ColPack::BipartiteGraphCore::m_vi_RightVertices.
Referenced by ReadBipartiteGraph().
int ColPack::BipartiteGraphInputOutput::ReadMatrixMarketBipartiteGraph | ( | string | s_InputFile | ) |
Read sparsity pattern of a matrix specified in Matrix Market format from a file and build a corresponding bipartite graph.
Definition at line 116 of file BipartiteGraphInputOutput.cpp.
References _TRUE, CalculateVertexDegrees(), Clear(), ColPack::BipartiteGraphCore::m_s_InputFile, ColPack::BipartiteGraphCore::m_vi_Edges, ColPack::BipartiteGraphCore::m_vi_LeftVertices, ColPack::BipartiteGraphCore::m_vi_RightVertices, mm_is_coordinate, mm_is_general, mm_is_integer, mm_is_pattern, mm_is_real, mm_is_symmetric, mm_read_banner(), mm_typecode_to_str(), STEP_DOWN, and STEP_UP.
Referenced by ReadBipartiteGraph().
int ColPack::BipartiteGraphInputOutput::ReadMeTiSBipartiteGraph | ( | string | s_InputFile | ) |
Read sparsity pattern of a matrix specified in MeTiS format from a file and build a corresponding bipartite graph.
Definition at line 388 of file BipartiteGraphInputOutput.cpp.
References _TRUE, CalculateVertexDegrees(), Clear(), ColPack::BipartiteGraphCore::m_s_InputFile, ColPack::BipartiteGraphCore::m_vi_Edges, ColPack::BipartiteGraphCore::m_vi_LeftVertices, and ColPack::BipartiteGraphCore::m_vi_RightVertices.
Referenced by ReadBipartiteGraph().
int ColPack::BipartiteGraphInputOutput::RowCompressedFormat2BipartiteGraph | ( | unsigned int ** | uip2_JacobianSparsityPattern, | |
int | i_RowCount, | |||
int | i_ColumnCount | |||
) |
Given a compressed sparse row representation, build the corresponding bipartite graph representation.
Precondition:
Return value:
Definition at line 913 of file BipartiteGraphInputOutput.cpp.
References CalculateVertexDegrees(), ColPack::BipartiteGraphCore::m_vi_Edges, ColPack::BipartiteGraphCore::m_vi_LeftVertices, and ColPack::BipartiteGraphCore::m_vi_RightVertices.
Referenced by BuildBPGraphFromRowCompressedFormat().