Skip to content

Commit 10de3b5

Browse files
committed
assertions
1 parent 4360c8f commit 10de3b5

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎include/boost/graph/personalized_page_rank.hpp‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ namespace graph
3838
sum_abs += std::abs(get(current, v) - get(previous, v));
3939
return sum_abs*num_vertices(g)<tol;
4040
}
41+
protected:
4142
std::size_t iters;
4243
double tol;
4344
};
@@ -140,6 +141,17 @@ namespace graph
140141
RankMap2 rank_map2
141142
BOOST_GRAPH_ENABLE_IF_MODELS_PARM(Graph, vertex_list_graph_tag))
142143
{
144+
using Vertex = typename graph_traits<Graph>::vertex_descriptor;
145+
using Edge = typename graph_traits<Graph>::edge_descriptor;
146+
BOOST_CONCEPT_ASSERT(( boost::IncidenceGraphConcept<Graph> ));
147+
BOOST_CONCEPT_ASSERT(( boost::VertexListGraphConcept<Graph> ));
148+
BOOST_CONCEPT_ASSERT(( boost::ReadablePropertyMapConcept<WeightMap, Edge> ));
149+
BOOST_CONCEPT_ASSERT(( boost::ReadablePropertyMapConcept<PersonalizationMap, Vertex>));
150+
BOOST_CONCEPT_ASSERT(( boost::ReadWritePropertyMapConcept<RankMap, Vertex> ));
151+
152+
153+
assert (damping>=-1.0 && damping<1.0 && "Damping outside the closed-open range [-1.0,1.0) could induce numerical instability."); // non-inclussive upper limit is deliberate
154+
143155
using rank_type = typename property_traits< PersonalizationMap >::value_type;
144156
rank_type personalization_norm(0);
145157
for (auto v : boost::make_iterator_range(vertices(g)))

0 commit comments

Comments
 (0)