tlp::CSVToGraphEdgeSrcTgtMapping Class Reference
Try to map CSV file rows to edges according to edge source and destination.
More...
#include <CSVGraphImport.h>
List of all members.
Public Member Functions
- CSVToGraphEdgeSrcTgtMapping (tlp::Graph *graph, unsigned int srcColumnIndex, unsigned int tgtColumnIndex, const std::string &propertyName, unsigned int firstRow, unsigned int lastRow, bool createMissinElements=false)
- std::pair< tlp::ElementType,
unsigned int > getElementForRow (unsigned int row)
- Return the graph element corresponding to the row.
- void begin ()
- void token (unsigned int row, unsigned int column, const std::string &token)
- void end (unsigned int rowNumber, unsigned int columnNumber)
Detailed Description
Try to map CSV file rows to edges according to edge source and destination.
For each row in the CSV file create an edge in the graph between source and destination nodes. Find source node by comparing id in the source CSV column and destination node by comparing id in the destination CSV column.
Constructor & Destructor Documentation
tlp::CSVToGraphEdgeSrcTgtMapping::CSVToGraphEdgeSrcTgtMapping |
( |
tlp::Graph * |
graph, |
|
|
unsigned int |
srcColumnIndex, |
|
|
unsigned int |
tgtColumnIndex, |
|
|
const std::string & |
propertyName, |
|
|
unsigned int |
firstRow, |
|
|
unsigned int |
lastRow, |
|
|
bool |
createMissinElements = false | |
|
) |
| | |
- Parameters:
-
| graph | The graph where the edges will be searched. |
| srcColumnIndex | The index of the column with the source node id in the CSV file. |
| tgtColumnIndex | The index of the column with the taret node id in the CSV file. |
| srcPropertyName | The name of the property to search source node id. |
| tgtPropertyName | The name of the property to search target node id. |
| firstRow | The first row to search ids. |
| lastRow | The last row to search ids. |
| createMissinElements | If true create source node, destination node if one of them is not found in the graph. |
Member Function Documentation
void tlp::CSVToGraphEdgeSrcTgtMapping::begin |
( |
|
) |
[virtual] |
void tlp::CSVToGraphEdgeSrcTgtMapping::end |
( |
unsigned int |
rowNumber, |
|
|
unsigned int |
columnNumber | |
|
) |
| | [virtual] |
Function called at the end of the parsing.
- Parameters:
-
| rowNumber | the number of row read in the file. |
| columnNumber | The column number for the line with the greatest column number. |
Implements tlp::CSVContentHandler.
std::pair<tlp::ElementType,unsigned int> tlp::CSVToGraphEdgeSrcTgtMapping::getElementForRow |
( |
unsigned int |
row |
) |
[virtual] |
void tlp::CSVToGraphEdgeSrcTgtMapping::token |
( |
unsigned int |
row, |
|
|
unsigned int |
column, |
|
|
const std::string & |
token | |
|
) |
| | [virtual] |
Function called for each tokens found in the file.
- Parameters:
-
| row | The row position of the token. |
| column | The column position of the token. |
| token | The token. |
Implements tlp::CSVContentHandler.