reader_utils.h File Reference

This file includes common file reader for GUDHI. More...

Go to the source code of this file.

Functions

void Gudhi::read_points (std::string file_name, std::vector< std::vector< double >> &points)
 Read a set of points to turn it into a vector< vector<double> > by filling points. More...
 
template<typename Graph_t , typename Filtration_value , typename Vertex_handle >
Graph_t Gudhi::read_graph (std::string file_name)
 Read a graph from a file. More...
 
template<typename Vertex_handle , typename Filtration_value >
bool Gudhi::read_simplex (std::istream &in_, std::vector< Vertex_handle > &simplex, Filtration_value &fil)
 Read a face from a file. More...
 
template<typename Simplex_key , typename Filtration_value >
bool Gudhi::read_hasse_simplex (std::istream &in_, std::vector< Simplex_key > &boundary, Filtration_value &fil)
 Read a hasse simplex from a file. More...
 
template<typename Filtration_value >
std::vector< std::vector< Filtration_value > > Gudhi::read_lower_triangular_matrix_from_csv_file (const std::string &filename, const char separator=';')
 Read a lower triangular distance matrix from a csv file. We assume that the .csv store the whole (square) matrix. More...
 
template<typename OutputIterator >
void Gudhi::read_persistence_intervals_and_dimension (std::string const &filename, OutputIterator out)
 
std::map< int, std::vector< std::pair< double, double > > > Gudhi::read_persistence_intervals_grouped_by_dimension (std::string const &filename)
 
std::vector< std::pair< double, double > > Gudhi::read_persistence_intervals_in_dimension (std::string const &filename, int only_this_dim=-1)
 

Detailed Description

This file includes common file reader for GUDHI.

Function Documentation

◆ read_graph()

template<typename Graph_t , typename Filtration_value , typename Vertex_handle >
Graph_t Gudhi::read_graph ( std::string  file_name)

Read a graph from a file.

Template Parameters
Graph_tType for the return graph. Must be constructible from iterators on pairs of Vertex_handle
Filtration_valueType for the value of the read filtration
Vertex_handleType for the value of the read vertices

File format: 1 simplex per line
Dim1 X11 X12 ... X1d Fil1
Dim2 X21 X22 ... X2d Fil2
etc

The vertices must be labeled from 0 to n-1. Every simplex must appear exactly once. Simplices of dimension more than 1 are ignored.

◆ read_hasse_simplex()

template<typename Simplex_key , typename Filtration_value >
bool Gudhi::read_hasse_simplex ( std::istream &  in_,
std::vector< Simplex_key > &  boundary,
Filtration_value fil 
)

Read a hasse simplex from a file.

File format: 1 simplex per line
Dim1 k11 k12 ... k1Dim1 Fil1
Dim2 k21 k22 ... k2Dim2 Fil2
etc

The key of a simplex is its position in the filtration order and also the number of its row in the file. Dimi ki1 ki2 ... kiDimi Fili means that the ith simplex in the filtration has dimension Dimi, filtration value fil1 and simplices with key ki1 ... kiDimi in its boundary.

◆ read_lower_triangular_matrix_from_csv_file()

template<typename Filtration_value >
std::vector<std::vector<Filtration_value> > Gudhi::read_lower_triangular_matrix_from_csv_file ( const std::string &  filename,
const char  separator = ';' 
)

Read a lower triangular distance matrix from a csv file. We assume that the .csv store the whole (square) matrix.

Author
Pawel Dlotko

Square matrix file format:
0;D12;...;D1j
D21;0;...;D2j
...
Dj1;Dj2;...;0

lower matrix file format:
0
D21;
D31;D32;
...
Dj1;Dj2;...;Dj(j-1);

◆ read_persistence_intervals_and_dimension()

template<typename OutputIterator >
void Gudhi::read_persistence_intervals_and_dimension ( std::string const &  filename,
OutputIterator  out 
)

Reads a file containing persistence intervals. Each line might contain 2, 3 or 4 values: [[field] dimension] birth death The output iterator out is used this way: *out++ = std::make_tuple(dim, birth, death); where dim is an int, birth a double, and death a double. Note: the function does not check that birth <= death.

◆ read_persistence_intervals_grouped_by_dimension()

std::map<int, std::vector<std::pair<double, double> > > Gudhi::read_persistence_intervals_grouped_by_dimension ( std::string const &  filename)
inline

Reads a file containing persistence intervals. Each line might contain 2, 3 or 4 values: [[field] dimension] birth death The return value is an std::map<dim, std::vector<std::pair<birth, death>>> where dim is an int, birth a double, and death a double. Note: the function does not check that birth <= death.

◆ read_persistence_intervals_in_dimension()

std::vector<std::pair<double, double> > Gudhi::read_persistence_intervals_in_dimension ( std::string const &  filename,
int  only_this_dim = -1 
)
inline

Reads a file containing persistence intervals. Each line might contain 2, 3 or 4 values: [[field] dimension] birth death If only_this_dim = -1, dimension is ignored and all lines are returned. If only_this_dim is >= 0, only the lines where dimension = only_this_dim (or where dimension is not specified) are returned. The return value is an std::vector<std::pair<birth, death>> where dim is an int, birth a double, and death a double. Note: the function does not check that birth <= death.

Examples:
Bottleneck_distance/bottleneck_distance.cpp.

◆ read_points()

void Gudhi::read_points ( std::string  file_name,
std::vector< std::vector< double >> &  points 
)
inline

Read a set of points to turn it into a vector< vector<double> > by filling points.

File format: 1 point per line
X11 X12 ... X1d
X21 X22 ... X2d
etc

◆ read_simplex()

template<typename Vertex_handle , typename Filtration_value >
bool Gudhi::read_simplex ( std::istream &  in_,
std::vector< Vertex_handle > &  simplex,
Filtration_value fil 
)

Read a face from a file.

File format: 1 simplex per line
Dim1 X11 X12 ... X1d Fil1
Dim2 X21 X22 ... X2d Fil2
etc

The vertices must be labeled from 0 to n-1. Every simplex must appear exactly once. Simplices of dimension more than 1 are ignored.

GUDHI  Version 3.3.0  - C++ library for Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding.  - Copyright : MIT Generated on Tue Aug 11 2020 11:09:13 for GUDHI by Doxygen 1.8.13