ColPack
ColPack::GraphInputOutput Class Reference

class GraphInputOutput in group1. More...

#include <GraphInputOutput.h>

Inheritance diagram for ColPack::GraphInputOutput:
Collaboration diagram for ColPack::GraphInputOutput:

List of all members.

Public Member Functions

int BuildGraphFromRowCompressedFormat (unsigned int **uip2_HessianSparsityPattern, int i_RowCount)
 Read the sparsity pattern of Hessian matrix represented in ADOLC format (Compressed Sparse Row format) and build a corresponding adjacency graph.
int ReadAdjacencyGraph (string s_InputFile, string s_fileFormat="AUTO_DETECTED")
 Read the sparsity pattern of a symmetric matrix in the specified file format from the specified filename and build an adjacency graph.
int ReadMatrixMarketAdjacencyGraph (string s_InputFile, bool b_getStructureOnly=false)
 Read the entries of a symmetric matrix in Matrix Market format and build the corresponding adjacency graph.
int WriteMatrixMarket (string s_OutputFile="-ColPack_debug.mtx", bool b_getStructureOnly=false)
 Write the structure of the graph into a file using Matrix Market format.
 GraphInputOutput ()
 ~GraphInputOutput ()
virtual void Clear ()
string GetInputFile ()
int ReadHarwellBoeingAdjacencyGraph (string s_InputFile)
 Read the entries of symmetric matrix in Harwell Boeing format and build the corresponding adjacency graph.
int ReadMeTiSAdjacencyGraph (string s_InputFile)
 Read the entries of symmetric matrix in MeTiS format and build the corresponding adjacency graph.
int ReadMeTiSAdjacencyGraph2 (string s_InputFile)
int PrintGraph ()
int PrintGraphStructure ()
int PrintGraphStructure2 ()
int PrintMatrix ()
int PrintMatrix (vector< int > &, vector< int > &, vector< double > &)
void PrintVertexDegrees ()

Private Member Functions

int ParseWidth (string FortranFormat)
void CalculateVertexDegrees ()

Detailed Description

class GraphInputOutput in group1.

This class provides the input methods for reading in matrix or graph files in supported formats for generating general graphs. Three input formats are supported by default - Matrix Market, Harwell Boeing and MeTiS.

Definition at line 35 of file GraphInputOutput.h.


Constructor & Destructor Documentation


Member Function Documentation

int ColPack::GraphInputOutput::BuildGraphFromRowCompressedFormat ( unsigned int **  uip2_HessianSparsityPattern,
int  i_RowCount 
)

Read the sparsity pattern of Hessian matrix represented in ADOLC format (Compressed Sparse Row format) and build a corresponding adjacency graph.

Precondition:

  • The Hessian matrix must be stored in Row Compressed Format

Return value:

  • i_HighestDegree

Definition at line 1241 of file GraphInputOutput.cpp.

References _FALSE, _UNKNOWN, STEP_DOWN, and STEP_UP.

Definition at line 73 of file GraphInputOutput.cpp.

References _UNKNOWN, and STEP_DOWN.

Reimplemented from ColPack::GraphCore.

Reimplemented in ColPack::GraphColoring, ColPack::GraphColoringInterface, and ColPack::GraphOrdering.

Definition at line 120 of file GraphInputOutput.cpp.

Reimplemented from ColPack::GraphCore.

Definition at line 128 of file GraphInputOutput.cpp.

int ColPack::GraphInputOutput::ParseWidth ( string  FortranFormat) [private]

Definition at line 28 of file GraphInputOutput.cpp.

References FALSE, and TRUE.

Definition at line 1018 of file GraphInputOutput.cpp.

References _FALSE, _TRUE, STEP_DOWN, and STEP_UP.

Definition at line 1096 of file GraphInputOutput.cpp.

References _TRUE, STEP_DOWN, and STEP_UP.

Referenced by main().

Here is the caller graph for this function:

Definition at line 1145 of file GraphInputOutput.cpp.

References _TRUE, and STEP_UP.

Definition at line 1177 of file GraphInputOutput.cpp.

References _TRUE, and STEP_UP.

int ColPack::GraphInputOutput::PrintMatrix ( vector< int > &  vi_Vertices,
vector< int > &  vi_Edges,
vector< double > &  vd_Values 
)

Definition at line 1204 of file GraphInputOutput.cpp.

References _TRUE, and STEP_UP.

int ColPack::GraphInputOutput::ReadAdjacencyGraph ( string  s_InputFile,
string  s_fileFormat = "AUTO_DETECTED" 
)

Read the sparsity pattern of a symmetric matrix in the specified file format from the specified filename and build an adjacency graph.

This function will

  • 1. Read the name of the matrix file and decide which matrix format the file used (based on the file extension). If the file name has no extension, the user will need to pass the 2nd parameter "fileType" explicitly to tell ColPack which matrix format is used
  • 2. Call the corresponding reading routine to build the graph

About input parameters:

  • fileName: name of the input file for a symmetric matrix. If the full path is not given, the file is assumed to be in the current directory
  • fileType can be either

Definition at line 1363 of file GraphInputOutput.cpp.

References _TRUE, ColPack::File::GetFileExtension(), ColPack::isHarwellBoeingFormat(), ColPack::isMatrixMarketFormat(), and ColPack::isMeTiSFormat().

Here is the call graph for this function:

Read the entries of symmetric matrix in Harwell Boeing format and build the corresponding adjacency graph.

Supported sub-format: MXTYPE[3] = (R | P) (S | U) (A) If MXTYPE[2] = 'U', the matrix structure must still be symmetric for ColPack to work correctly

Definition at line 365 of file GraphInputOutput.cpp.

References _FALSE, _UNKNOWN, ConvertHarwellBoeingDouble(), and Pause().

Here is the call graph for this function:

int ColPack::GraphInputOutput::ReadMatrixMarketAdjacencyGraph ( string  s_InputFile,
bool  b_getStructureOnly = false 
)

Read the entries of a symmetric matrix in Matrix Market format and build the corresponding adjacency graph.

Precondition:

  • s_InputFile should point to the MatrixMarket-format input file (file name usually ends with .mtx)
  • If (b_getStructureOnly == true) only the structure of the matrix is read. All the values for the non-zeros in the matrix will be ignored. If the input file contains only the graph structure, the value of b_getStructureOnly will be ignored

Definition at line 175 of file GraphInputOutput.cpp.

References _FALSE, _TRUE, ColPack::f(), mm_is_coordinate, mm_is_general, mm_is_integer, mm_is_pattern, mm_is_real, mm_is_symmetric, mm_read_banner(), and mm_typecode_to_str().

Here is the call graph for this function:

Read the entries of symmetric matrix in MeTiS format and build the corresponding adjacency graph.

Definition at line 541 of file GraphInputOutput.cpp.

References _FALSE, _TRUE, STEP_DOWN, and STEP_UP.

Definition at line 786 of file GraphInputOutput.cpp.

References _FALSE, _TRUE, ColPack::StringTokenizer::GetNextToken(), ColPack::StringTokenizer::HasMoreTokens(), STEP_DOWN, and STEP_UP.

Here is the call graph for this function:

int ColPack::GraphInputOutput::WriteMatrixMarket ( string  s_OutputFile = "-ColPack_debug.mtx",
bool  b_getStructureOnly = false 
)

Write the structure of the graph into a file using Matrix Market format.

NOTES:

  • Because ColPack's internal graph does not have self loop, the output graph will not have any self-loops that exist in the input, i.e., diagonal entries of the input graph will be removed.

Definition at line 133 of file GraphInputOutput.cpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines