Commit 53788387 authored by Tiago Peixoto's avatar Tiago Peixoto

Fix runtime error eigenvector() when no weights are used

This fixes ticket #84
parent 77ef683f
......@@ -36,7 +36,7 @@ long double eigenvector(GraphInterface& g, boost::any w, boost::any c,
throw ValueException("vertex property must be of floating point"
" value type");
typedef ConstantPropertyMap<int, GraphInterface::vertex_t> weight_map_t;
typedef ConstantPropertyMap<int, GraphInterface::edge_t> weight_map_t;
typedef mpl::push_back<writable_edge_scalar_properties, weight_map_t>::type
weight_props_t;
......@@ -49,7 +49,7 @@ long double eigenvector(GraphInterface& g, boost::any w, boost::any c,
(get_eigenvector(),
_1, g.GetVertexIndex(), g.GetEdgeIndex(), _2,
_3, epsilon, max_iter, ref(eig)),
writable_edge_scalar_properties(),
weight_props_t(),
vertex_floating_properties())(w, c);
return eig;
}
......
......@@ -56,7 +56,7 @@ struct get_eigenvector
}
t_type norm = 0;
t_type delta = epsilon + 1;
size_t iter = 0;
......@@ -118,7 +118,7 @@ struct get_eigenvector
c[v] = c_temp[v];
}
}
eig = 1. / norm;
}
};
......
......@@ -364,7 +364,7 @@ def eigenvector(g, weight=None, vprop=None, epsilon=1e-6, max_iter=None):
----------
g : :class:`~graph_tool.Graph`
Graph to be used.
weights : :class:`~graph_tool.PropertyMap` (optional, default: ``None``)
weight : :class:`~graph_tool.PropertyMap` (optional, default: ``None``)
Edge property map with the edge weights.
vprop : :class:`~graph_tool.PropertyMap`, optional (default: ``None``)
Vertex property map where the values of eigenvector must be stored.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment