summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-12-08 17:02:26 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2016-12-08 17:02:26 +0000
commitccc1ca066fa7c1fb35929eceb52f2f36179aea37 (patch)
tree0d3a407626c2074df39b5f4d5eb923498804465c
parent69907a03283337e76d7763f82250b4e2a6b8f631 (diff)
Remove inline from read_graph (now inline)
Remove Edge_t template (not needed) Add documentation on template params git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/distance_matrix_in_rips_module@1839 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a011b11cddf1a20e29743e6b170dac054ac79c12
-rw-r--r--src/Simplex_tree/example/simplex_tree_from_cliques_of_graph.cpp3
-rw-r--r--src/common/include/gudhi/reader_utils.h9
2 files changed, 8 insertions, 4 deletions
diff --git a/src/Simplex_tree/example/simplex_tree_from_cliques_of_graph.cpp b/src/Simplex_tree/example/simplex_tree_from_cliques_of_graph.cpp
index 1dff4529..d1b8b2de 100644
--- a/src/Simplex_tree/example/simplex_tree_from_cliques_of_graph.cpp
+++ b/src/Simplex_tree/example/simplex_tree_from_cliques_of_graph.cpp
@@ -35,7 +35,6 @@ typedef double Filtration_value;
typedef boost::adjacency_list < boost::vecS, boost::vecS, boost::undirectedS,
boost::property < vertex_filtration_t, Filtration_value >,
boost::property < edge_filtration_t, Filtration_value > > Graph_t;
-typedef std::pair< Vertex_handle, Vertex_handle > Edge_t;
int main(int argc, char * const argv[]) {
if (argc != 3) {
@@ -51,7 +50,7 @@ int main(int argc, char * const argv[]) {
Simplex_tree<> st;
start = clock();
- auto g = read_graph<Graph_t, Edge_t, Filtration_value, Vertex_handle>(filegraph);
+ auto g = read_graph<Graph_t, Filtration_value, Vertex_handle>(filegraph);
// insert the graph in the simplex tree as 1-skeleton
st.insert_graph(g);
end = clock();
diff --git a/src/common/include/gudhi/reader_utils.h b/src/common/include/gudhi/reader_utils.h
index 2d774d4d..4c8d85cd 100644
--- a/src/common/include/gudhi/reader_utils.h
+++ b/src/common/include/gudhi/reader_utils.h
@@ -74,6 +74,10 @@ inline void read_points(std::string file_name, std::vector< std::vector< double
/**
* @brief Read a graph from a file.
*
+ * \tparam Graph_t Type for the return graph. Must be constructible from iterators on pairs of Vertex_handle
+ * \tparam Filtration_value Type for the value of the read filtration
+ * \tparam Vertex_handle Type for the value of the read vertices
+ *
* File format: 1 simplex per line<br>
* Dim1 X11 X12 ... X1d Fil1<br>
* Dim2 X21 X22 ... X2d Fil2<br>
@@ -83,13 +87,14 @@ inline void read_points(std::string file_name, std::vector< std::vector< double
* Every simplex must appear exactly once.
* Simplices of dimension more than 1 are ignored.
*/
-template< typename Graph_t, typename Edge_t, typename Filtration_value, typename Vertex_handle >
-inline Graph_t read_graph(std::string file_name) {
+template< typename Graph_t, typename Filtration_value, typename Vertex_handle >
+Graph_t read_graph(std::string file_name) {
std::ifstream in_(file_name.c_str(), std::ios::in);
if (!in_.is_open()) {
std::cerr << "Unable to open file " << file_name << std::endl;
}
+ typedef std::pair< Vertex_handle, Vertex_handle > Edge_t;
std::vector< Edge_t > edges;
std::vector< Filtration_value > edges_fil;
std::map< Vertex_handle, Filtration_value > vertices;