Commit 531da979 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

_really_ change all tabs to spaces (sed, why have you forsaken me?)


git-svn-id: https://svn.forked.de/graph-tool/trunk@59 d4600afd-f417-0410-95de-beed9576f240
parent 6b764b67
......@@ -100,17 +100,17 @@ void GraphInterface::SetVertexFilterProperty(string property)
dynamic_property_map& pmap = find_property_map(_properties, property, typeid(graph_traits<multigraph_t>::vertex_descriptor));
if (get_static_property_map<vector_property_map<double,vertex_index_map_t> >(&pmap))
_vertex_filter_map = get_static_property_map<vector_property_map<double,vertex_index_map_t> >(pmap);
_vertex_filter_map = get_static_property_map<vector_property_map<double,vertex_index_map_t> >(pmap);
else if (get_static_property_map<HashedDescriptorMap<vertex_index_map_t,double> >(&pmap))
_vertex_filter_map = get_static_property_map<HashedDescriptorMap<vertex_index_map_t,double> >(pmap);
_vertex_filter_map = get_static_property_map<HashedDescriptorMap<vertex_index_map_t,double> >(pmap);
else if (get_static_property_map<vector_property_map<size_t,vertex_index_map_t> >(&pmap))
_vertex_filter_map = get_static_property_map<vector_property_map<size_t,vertex_index_map_t> >(pmap);
_vertex_filter_map = get_static_property_map<vector_property_map<size_t,vertex_index_map_t> >(pmap);
else if (get_static_property_map<HashedDescriptorMap<vertex_index_map_t,size_t> >(&pmap))
_vertex_filter_map = get_static_property_map<HashedDescriptorMap<vertex_index_map_t,size_t> >(pmap);
_vertex_filter_map = get_static_property_map<HashedDescriptorMap<vertex_index_map_t,size_t> >(pmap);
else if (get_static_property_map<vertex_index_map_t>(&pmap))
_vertex_filter_map = get_static_property_map<vertex_index_map_t>(pmap);
_vertex_filter_map = get_static_property_map<vertex_index_map_t>(pmap);
else
_vertex_filter_map = DynamicPropertyMapWrap<double, graph_traits<multigraph_t>::vertex_descriptor>(pmap);
_vertex_filter_map = DynamicPropertyMapWrap<double, graph_traits<multigraph_t>::vertex_descriptor>(pmap);
}
catch (property_not_found)
{
......@@ -132,17 +132,17 @@ void GraphInterface::SetEdgeFilterProperty(string property)
dynamic_property_map& pmap = find_property_map(_properties, property, typeid(graph_traits<multigraph_t>::edge_descriptor));
if (get_static_property_map<vector_property_map<double,edge_index_map_t> >(&pmap))
_edge_filter_map = get_static_property_map<vector_property_map<double,edge_index_map_t> >(pmap);
_edge_filter_map = get_static_property_map<vector_property_map<double,edge_index_map_t> >(pmap);
else if (get_static_property_map<HashedDescriptorMap<edge_index_map_t,double> >(&pmap))
_edge_filter_map = get_static_property_map<HashedDescriptorMap<edge_index_map_t,double> >(pmap);
_edge_filter_map = get_static_property_map<HashedDescriptorMap<edge_index_map_t,double> >(pmap);
else if (get_static_property_map<vector_property_map<size_t,edge_index_map_t> >(&pmap))
_edge_filter_map = get_static_property_map<vector_property_map<size_t,edge_index_map_t> >(pmap);
_edge_filter_map = get_static_property_map<vector_property_map<size_t,edge_index_map_t> >(pmap);
else if (get_static_property_map<HashedDescriptorMap<edge_index_map_t,size_t> >(&pmap))
_edge_filter_map = get_static_property_map<HashedDescriptorMap<edge_index_map_t,size_t> >(pmap);
_edge_filter_map = get_static_property_map<HashedDescriptorMap<edge_index_map_t,size_t> >(pmap);
else if (get_static_property_map<edge_index_map_t>(&pmap))
_edge_filter_map = get_static_property_map<edge_index_map_t>(pmap);
_edge_filter_map = get_static_property_map<edge_index_map_t>(pmap);
else
_edge_filter_map = DynamicPropertyMapWrap<double, graph_traits<multigraph_t>::edge_descriptor>(pmap);
_edge_filter_map = DynamicPropertyMapWrap<double, graph_traits<multigraph_t>::edge_descriptor>(pmap);
}
catch (property_not_found)
{
......@@ -336,16 +336,16 @@ struct label_parallel_edges
typename graph_traits<Graph>::out_edge_iterator e1, e2, e_end;
for (tie(e1, e_end) = out_edges(*v, g); e1 != e_end; ++e1)
{
if (p_edges.find(*e1) != p_edges.end())
continue;
size_t n = 0;
put(parallel, *e1, n);
for (tie(e2, e_end) = out_edges(*v, g); e2 != e_end; ++e2)
if (*e2 != *e1 && target(*e1, g) == target(*e2, g))
{
put(parallel, *e2, ++n);
p_edges.insert(*e2);
}
if (p_edges.find(*e1) != p_edges.end())
continue;
size_t n = 0;
put(parallel, *e1, n);
for (tie(e2, e_end) = out_edges(*v, g); e2 != e_end; ++e2)
if (*e2 != *e1 && target(*e1, g) == target(*e2, g))
{
put(parallel, *e2, ++n);
p_edges.insert(*e2);
}
}
}
}
......@@ -404,9 +404,9 @@ struct compute_gursoy
iter = n;
square_topology<mt19937> topology(rng, n);
gursoy_atun_layout(g, topology, position_map, iterations(iter).
diameter_range(make_pair(sqrt(double(n)), 1.0)).
learning_constant_range(make_pair(0.8, 0.2)).
vertex_index_map(index_map));
diameter_range(make_pair(sqrt(double(n)), 1.0)).
learning_constant_range(make_pair(0.8, 0.2)).
vertex_index_map(index_map));
typename graph_traits<Graph>::vertex_iterator v, v_begin, v_end;
tie(v_begin, v_end) = vertices(g);
for(v = v_begin; v != v_end; ++v)
......
......@@ -190,11 +190,11 @@ private:
// vertex filter
std::string _vertex_filter_property;
typedef boost::variant<boost::vector_property_map<double, vertex_index_map_t>,
HashedDescriptorMap<vertex_index_map_t,double>,
boost::vector_property_map<size_t, vertex_index_map_t>,
HashedDescriptorMap<vertex_index_map_t, size_t>,
vertex_index_map_t,
DynamicPropertyMapWrap<double, boost::graph_traits<multigraph_t>::vertex_descriptor> > vertex_filter_map_t;
HashedDescriptorMap<vertex_index_map_t,double>,
boost::vector_property_map<size_t, vertex_index_map_t>,
HashedDescriptorMap<vertex_index_map_t, size_t>,
vertex_index_map_t,
DynamicPropertyMapWrap<double, boost::graph_traits<multigraph_t>::vertex_descriptor> > vertex_filter_map_t;
vertex_filter_map_t _vertex_filter_map;
std::pair<double,double> _vertex_range;
boost::python::object _vertex_python_filter;
......@@ -202,11 +202,11 @@ private:
// edge filter
std::string _edge_filter_property;
typedef boost::variant<boost::vector_property_map<double, edge_index_map_t>,
HashedDescriptorMap<edge_index_map_t, double>,
boost::vector_property_map<size_t, edge_index_map_t>,
HashedDescriptorMap<edge_index_map_t, size_t>,
edge_index_map_t,
DynamicPropertyMapWrap<double, boost::graph_traits<multigraph_t>::edge_descriptor> > edge_filter_map_t;
HashedDescriptorMap<edge_index_map_t, double>,
boost::vector_property_map<size_t, edge_index_map_t>,
HashedDescriptorMap<edge_index_map_t, size_t>,
edge_index_map_t,
DynamicPropertyMapWrap<double, boost::graph_traits<multigraph_t>::edge_descriptor> > edge_filter_map_t;
edge_filter_map_t _edge_filter_map;
std::pair<double,double> _edge_range;
boost::python::object _edge_python_filter;
......
......@@ -111,10 +111,10 @@ private:
template <typename Graph>
class UndirectedAdaptorEdgeIterator
: public iterator<std::bidirectional_iterator_tag,
typename UndirectedAdaptor<Graph>::EdgeDescriptor,
std::ptrdiff_t,
typename UndirectedAdaptor<Graph>::EdgeDescriptor*,
typename UndirectedAdaptor<Graph>::EdgeDescriptor> //not a reference!
typename UndirectedAdaptor<Graph>::EdgeDescriptor,
std::ptrdiff_t,
typename UndirectedAdaptor<Graph>::EdgeDescriptor*,
typename UndirectedAdaptor<Graph>::EdgeDescriptor> //not a reference!
{
public:
UndirectedAdaptorEdgeIterator() {}
......@@ -174,19 +174,19 @@ private:
template <typename Graph>
class UndirectedAdaptorOutEdgeIterator
: public iterator<std::bidirectional_iterator_tag,
typename UndirectedAdaptor<Graph>::EdgeDescriptor,
std::ptrdiff_t,
typename UndirectedAdaptor<Graph>::EdgeDescriptor*,
typename UndirectedAdaptor<Graph>::EdgeDescriptor> //not a reference
typename UndirectedAdaptor<Graph>::EdgeDescriptor,
std::ptrdiff_t,
typename UndirectedAdaptor<Graph>::EdgeDescriptor*,
typename UndirectedAdaptor<Graph>::EdgeDescriptor> //not a reference
{
public:
UndirectedAdaptorOutEdgeIterator() {};
UndirectedAdaptorOutEdgeIterator(typename graph_traits<Graph>::out_edge_iterator out_iter,
typename graph_traits<Graph>::in_edge_iterator in_iter,
const std::pair<typename graph_traits<Graph>::out_edge_iterator,
typename graph_traits<Graph>::out_edge_iterator> out_range,
const std::pair<typename graph_traits<Graph>::in_edge_iterator,
typename graph_traits<Graph>::in_edge_iterator> in_range)
typename graph_traits<Graph>::in_edge_iterator in_iter,
const std::pair<typename graph_traits<Graph>::out_edge_iterator,
typename graph_traits<Graph>::out_edge_iterator> out_range,
const std::pair<typename graph_traits<Graph>::in_edge_iterator,
typename graph_traits<Graph>::in_edge_iterator> in_range)
:_out_range(out_range), _in_range(in_range), _out_iter(out_iter), _in_iter(in_iter) {};
typename UndirectedAdaptor<Graph>::EdgeDescriptor operator*() const
......@@ -280,10 +280,10 @@ public:
template <typename Graph>
class UndirectedAdaptorAdjacencyIterator
: public iterator<std::bidirectional_iterator_tag,
typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor,
std::ptrdiff_t,
typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor*,
typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor> //not a reference
typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor,
std::ptrdiff_t,
typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor*,
typename graph_traits<UndirectedAdaptor<Graph> >::vertex_descriptor> //not a reference
{
public:
UndirectedAdaptorAdjacencyIterator(){};
......
......@@ -59,15 +59,15 @@ struct get_assortativity_coefficient
a[k1]++;
b[k2]++;
if (k1 == k2)
e_kk++;
e_kk++;
n_edges++;
if(is_convertible<typename graph_traits<Graph>::directed_category, undirected_tag>::value)
{
a[k2]++;
a[k1]++;
if (k1 == k2)
e_kk++;
n_edges++;
a[k2]++;
a[k1]++;
if (k1 == k2)
e_kk++;
n_edges++;
}
}
......@@ -75,7 +75,7 @@ struct get_assortativity_coefficient
for (typeof(a.begin()) iter = a.begin(); iter != a.end(); ++iter)
if (b.find(iter->second) != b.end())
t2 += double(iter->second * b[iter->first]);
t2 += double(iter->second * b[iter->first]);
t2 /= n_edges*n_edges;
r = (t1 - t2)/(1.0 - t2);
......@@ -89,11 +89,11 @@ struct get_assortativity_coefficient
k2 = _deg(target(*e,g),g);
int one = 1;
if(is_convertible<typename graph_traits<Graph>::directed_category, undirected_tag>::value)
one = 2; // nice! :-)
one = 2; // nice! :-)
double tl2 = (t2*(n_edges*n_edges) - b[k1] - a[k2])/((n_edges-one)*(n_edges-one));
double tl1 = t1*n_edges;
if (k1==k2)
tl1 -= one;
tl1 -= one;
tl1 /= n_edges - one;
double rl = (tl1 - tl2)/(1.0 - tl2);
r_err += (r-rl)*(r-rl);
......@@ -120,7 +120,7 @@ struct choose_assortativity_coefficient
{
DegreeSelector deg(_deg_name, _g);
check_filter(_g, bind<void>(get_assortativity_coefficient<DegreeSelector>(deg), _1, var(_a), var(_a_err)),
reverse_check(),directed_check());
reverse_check(),directed_check());
}
};
......@@ -180,10 +180,10 @@ struct get_scalar_assortativity_coefficient
n_edges++;
if(is_convertible<typename graph_traits<Graph>::directed_category, undirected_tag>::value)
{
a[k2]++;
b[k1]++;
e_xy += k1*k2;
n_edges++;
a[k2]++;
b[k1]++;
e_xy += k1*k2;
n_edges++;
}
}
......@@ -210,16 +210,16 @@ struct get_scalar_assortativity_coefficient
k2 = _deg(target(*e,g),g);
int one = 1;
if(is_convertible<typename graph_traits<Graph>::directed_category, undirected_tag>::value)
one = 2;
one = 2;
double t1l = (e_xy - k1*k2)/(n_edges-one);
double avg_al = (avg_a*n_edges - k1)/(n_edges-one), avg_bl = (avg_b*n_edges - k2)/(n_edges-one);
double sal = sa - 2*diff_a*(avg_al-avg_a) + (avg_al-avg_a)*(avg_al-avg_a);
double sbl = sb - 2*diff_b*(avg_bl-avg_b) + (avg_bl-avg_b)*(avg_bl-avg_b);
double rl;
if (sal*sbl > 0)
rl = (t1l - avg_al*avg_bl)/(sal*sbl);
rl = (t1l - avg_al*avg_bl)/(sal*sbl);
else
rl = (t1l - avg_al*avg_bl);
rl = (t1l - avg_al*avg_bl);
r_err += (r-rl)*(r-rl);
}
r_err = sqrt(r_err);
......@@ -244,7 +244,7 @@ struct choose_scalar_assortativity_coefficient
{
DegreeSelector deg(_deg_name, _g);
check_filter(_g, bind<void>(get_scalar_assortativity_coefficient<DegreeSelector>(deg), _1, var(_a), var(_a_err)),
reverse_check(),directed_check());
reverse_check(),directed_check());
}
};
......
......@@ -163,14 +163,14 @@ class GraphInterfaceWrap: public GraphInterface
{
public:
void GenerateCorrelatedConfigurationalModel(size_t N, object pjk, object ceil_pjk, object inv_ceil_pjk, double ceil_pjk_bound,
object corr, object ceil_corr, object inv_ceil_corr, double ceil_corr_bound, bool undirected_corr,
size_t seed, bool verbose)
object corr, object ceil_corr, object inv_ceil_corr, double ceil_corr_bound, bool undirected_corr,
size_t seed, bool verbose)
{
GraphInterface& base = *this;
base.GenerateCorrelatedConfigurationalModel(N, pjk_t(python_function(pjk)), pjk_t(python_function(ceil_pjk)),
inv_ceil_t(python_function(inv_ceil_pjk)),
ceil_pjk_bound, corr_t(python_function(corr)), corr_t(python_function(ceil_corr)),
inv_corr_t(python_function(inv_ceil_corr)), ceil_corr_bound, undirected_corr, seed, verbose);
inv_ceil_t(python_function(inv_ceil_pjk)),
ceil_pjk_bound, corr_t(python_function(corr)), corr_t(python_function(ceil_corr)),
inv_corr_t(python_function(inv_ceil_corr)), ceil_corr_bound, undirected_corr, seed, verbose);
}
struct python_function
......
......@@ -61,25 +61,25 @@ pair<int,int> get_triangles(typename graph_traits<Graph>::vertex_descriptor v, c
for (n2 = n2_begin; n2 != n2_end; ++n2)
{
if (*n2 == *n1) // no self-loops
continue;
continue;
if (neighbour_set2.find(*n2) != neighbour_set2.end())
continue;
continue;
else
neighbour_set2.insert(*n2);
neighbour_set2.insert(*n2);
typename graph_traits<Graph>::adjacency_iterator n3_begin, n3_end, n3;
tie(n3_begin, n3_end) = adjacent_vertices(*n2, g);
for (n3 = n3_begin; n3 != n3_end; ++n3)
{
if (*n3 == *n2) // no self-loops
continue;
if (neighbour_set3.find(*n3) != neighbour_set3.end())
continue;
else
neighbour_set3.insert(*n3);
if (*n3 == *n2) // no self-loops
continue;
if (neighbour_set3.find(*n3) != neighbour_set3.end())
continue;
else
neighbour_set3.insert(*n3);
if (*n3 == v) //found a triangle
triangles++;
if (*n3 == v) //found a triangle
triangles++;
}
neighbour_set3.clear();
}
......@@ -162,8 +162,8 @@ struct set_clustering_to_property
struct get_undirected_graph
{
typedef typename mpl::if_< is_convertible<typename graph_traits<Graph>::directed_category, directed_tag>,
const UndirectedAdaptor<Graph>,
const Graph& >::type type;
const UndirectedAdaptor<Graph>,
const Graph& >::type type;
};
};
......
This diff is collapsed.
......@@ -108,27 +108,27 @@ struct get_community_network
iostreams::filtering_stream<iostreams::output> stream;
ofstream file_stream;
if (file == "-")
stream.push(cout);
stream.push(cout);
else
{
file_stream.open(file.c_str(), ios_base::out | ios_base::binary);
file_stream.exceptions(ios_base::badbit | ios_base::failbit);
if (ends_with(file,".gz"))
stream.push(iostreams::gzip_compressor());
if (ends_with(file,".bz2"))
stream.push(iostreams::bzip2_compressor());
stream.push(file_stream);
file_stream.open(file.c_str(), ios_base::out | ios_base::binary);
file_stream.exceptions(ios_base::badbit | ios_base::failbit);
if (ends_with(file,".gz"))
stream.push(iostreams::gzip_compressor());
if (ends_with(file,".bz2"))
stream.push(iostreams::bzip2_compressor());
stream.push(file_stream);
}
stream.exceptions(ios_base::badbit | ios_base::failbit);
if (graphviz)
{
dp.property("vertex_id", comm_vertex_index);
write_graphviz(stream, comm_graph, dp, string("vertex_id"));
dp.property("vertex_id", comm_vertex_index);
write_graphviz(stream, comm_graph, dp, string("vertex_id"));
}
else
{
write_graphml(stream, comm_graph, comm_vertex_index, dp, true);
write_graphml(stream, comm_graph, comm_vertex_index, dp, true);
}
stream.reset();
}
......@@ -184,7 +184,7 @@ void GraphInterface::GetCommunityNetwork(string property, string out_file, strin
dynamic_properties_copy edge_properties;
for (typeof(_properties.begin()) iter = _properties.begin(); iter != _properties.end(); ++iter)
if (iter->second->key() == typeid(graph_traits<multigraph_t>::edge_descriptor))
edge_properties.insert(iter->first, auto_ptr<dynamic_property_map>(iter->second));
edge_properties.insert(iter->first, auto_ptr<dynamic_property_map>(iter->second));
check_filter(*this, bind<void>(get_community_network(), _1, var(comm_map), property, var(edge_properties), out_file, format), reverse_check(), directed_check());
}
......
......@@ -56,8 +56,8 @@ struct get_correlation_histogram
hist[key]++;
if(is_convertible<typename graph_traits<Graph>::directed_category, undirected_tag>::value)
{
swap(key.first, key.second);
hist[key]++;
swap(key.first, key.second);
hist[key]++;
}
}
}
......@@ -74,7 +74,7 @@ template <class SecondDegreeSelectors>
struct choose_vertex_correlation_histogram
{
choose_vertex_correlation_histogram(const GraphInterface &g, GraphInterface::deg_t deg1,
GraphInterface::deg_t deg2, GraphInterface::hist2d_t &hist)
GraphInterface::deg_t deg2, GraphInterface::hist2d_t &hist)
: _g(g), _hist(hist)
{
tie(_deg1, _deg_name1) = get_degree_type(deg1);
......@@ -90,10 +90,10 @@ struct choose_vertex_correlation_histogram
{
if (mpl::at<degree_selector_index,DegreeSelector2>::type::value == _parent._deg2)
{
DegreeSelector1 deg1(_parent._deg_name1, _parent._g);
DegreeSelector2 deg2(_parent._deg_name2, _parent._g);
check_filter(_parent._g, bind<void>(get_correlation_histogram<DegreeSelector1,DegreeSelector2>(deg1,deg2), _1, var(_parent._hist)),
reverse_check(),directed_check());
DegreeSelector1 deg1(_parent._deg_name1, _parent._g);
DegreeSelector2 deg2(_parent._deg_name2, _parent._g);
check_filter(_parent._g, bind<void>(get_correlation_histogram<DegreeSelector1,DegreeSelector2>(deg1,deg2), _1, var(_parent._hist)),
reverse_check(),directed_check());
}
}
choose_vertex_correlation_histogram<SecondDegreeSelectors> _parent;
......@@ -155,8 +155,8 @@ struct get_edge_correlation_histogram
hist[key]++;
if(is_convertible<typename graph_traits<Graph>::directed_category, undirected_tag>::value)
{
swap(get<0>(key), get<2>(key));
hist[key]++;
swap(get<0>(key), get<2>(key));
hist[key]++;
}
}
}
......@@ -174,7 +174,7 @@ template <class SecondDegreeSelectors>
struct choose_edge_vertex_correlation_histogram
{
choose_edge_vertex_correlation_histogram(const GraphInterface& g, GraphInterface::deg_t deg1, scalarS& edge_scalar,
GraphInterface::deg_t deg2, GraphInterface::hist3d_t& hist)
GraphInterface::deg_t deg2, GraphInterface::hist3d_t& hist)
: _g(g), _edge_scalar(edge_scalar), _hist(hist)
{
tie(_deg1, _deg_name1) = get_degree_type(deg1);
......@@ -190,11 +190,11 @@ struct choose_edge_vertex_correlation_histogram
{
if (mpl::at<degree_selector_index,DegreeSelector2>::type::value == _parent._deg2)
{
DegreeSelector1 deg1(_parent._deg_name1, _parent._g);
DegreeSelector2 deg2(_parent._deg_name2, _parent._g);
check_filter(_parent._g, bind<void>(get_edge_correlation_histogram<DegreeSelector1,DegreeSelector2>(deg1,deg2,_parent._edge_scalar),
_1, var(_parent._hist)),
reverse_check(),directed_check());
DegreeSelector1 deg1(_parent._deg_name1, _parent._g);
DegreeSelector2 deg2(_parent._deg_name2, _parent._g);
check_filter(_parent._g, bind<void>(get_edge_correlation_histogram<DegreeSelector1,DegreeSelector2>(deg1,deg2,_parent._edge_scalar),
_1, var(_parent._hist)),
reverse_check(),directed_check());
}
}
choose_edge_vertex_correlation_histogram<SecondDegreeSelectors> _parent;
......
......@@ -62,7 +62,7 @@ template <class SecondDegreeSelectors>
struct choose_combined_degree_histogram
{
choose_combined_degree_histogram(const GraphInterface &g, GraphInterface::deg_t deg1,
GraphInterface::deg_t deg2, GraphInterface::hist2d_t &hist)
GraphInterface::deg_t deg2, GraphInterface::hist2d_t &hist)
: _g(g), _hist(hist)
{
tie(_deg1, _deg_name1) = get_degree_type(deg1);
......@@ -78,10 +78,10 @@ struct choose_combined_degree_histogram
{
if (mpl::at<degree_selector_index,DegreeSelector2>::type::value == _parent._deg2)
{
DegreeSelector1 deg1(_parent._deg_name1, _parent._g);
DegreeSelector2 deg2(_parent._deg_name2, _parent._g);
check_filter(_parent._g, bind<void>(get_combined_degree_histogram<DegreeSelector1,DegreeSelector2>(deg1,deg2), _1, var(_parent._hist)),
reverse_check(),directed_check());
DegreeSelector1 deg1(_parent._deg_name1, _parent._g);
DegreeSelector2 deg2(_parent._deg_name2, _parent._g);
check_filter(_parent._g, bind<void>(get_combined_degree_histogram<DegreeSelector1,DegreeSelector2>(deg1,deg2), _1, var(_parent._hist)),
reverse_check(),directed_check());
}
}
choose_combined_degree_histogram<SecondDegreeSelectors>& _parent;
......@@ -151,12 +151,12 @@ struct get_average_combined_degree_correlation
iter->second.first /= N;
if (N > 1)
{
double err = (iter->second.second - N*iter->second.first*iter->second.first)/(N*(N-1));
iter->second.second = (err<0.0)?0.0:sqrt(err);
double err = (iter->second.second - N*iter->second.first*iter->second.first)/(N*(N-1));
iter->second.second = (err<0.0)?0.0:sqrt(err);
}
else
{
iter->second.second = 0.0;
iter->second.second = 0.0;
}
}
}
......@@ -168,7 +168,7 @@ template <class SecondDegreeSelectors>
struct choose_average_combined_degree_correlation
{
choose_average_combined_degree_correlation(const GraphInterface &g, GraphInterface::deg_t deg1,
GraphInterface::deg_t deg2, GraphInterface::avg_corr_t &avg_corr)
GraphInterface::deg_t deg2, GraphInterface::avg_corr_t &avg_corr)
: _g(g), _avg_corr(avg_corr)
{
tie(_deg1, _deg_name1) = get_degree_type(deg1);
......@@ -184,11 +184,11 @@ struct choose_average_combined_degree_correlation
{
if (mpl::at<degree_selector_index,DegreeSelector2>::type::value == _parent._deg2)
{
DegreeSelector1 deg1(_parent._deg_name1, _parent._g);
DegreeSelector2 deg2(_parent._deg_name2, _parent._g);
check_filter(_parent._g, bind<void>(get_average_combined_degree_correlation<DegreeSelector1,DegreeSelector2>(deg1,deg2),
_1, var(_parent._avg_corr)),
reverse_check(),directed_check());
DegreeSelector1 deg1(_parent._deg_name1, _parent._g);
DegreeSelector2 deg2(_parent._deg_name2, _parent._g);
check_filter(_parent._g, bind<void>(get_average_combined_degree_correlation<DegreeSelector1,DegreeSelector2>(deg1,deg2),
_1, var(_parent._avg_corr)),
reverse_check(),directed_check());
}
}
choose_average_combined_degree_correlation<SecondDegreeSelectors>& _parent;
......
......@@ -56,12 +56,12 @@ struct get_average_nearest_neighbours_correlation
typename graph_traits<Graph>::out_edge_iterator e, e_begin, e_end;
tie(e_begin,e_end) = out_edges(*v,g);
for(e = e_begin; e != e_end; ++e)
{
typename AvgDeg::value_type::second_type::first_type deg = _neighbours_degree(target(*e,g),g);
typename AvgDeg::key_type orig_deg = _origin_degree(*v,g);
avg_deg[orig_deg].first += deg;
avg_deg[orig_deg].second += deg*deg;
count[orig_deg]++;
{
typename AvgDeg::value_type::second_type::first_type deg = _neighbours_degree(target(*e,g),g);
typename AvgDeg::key_type orig_deg = _origin_degree(*v,g);
avg_deg[orig_deg].first += deg;
avg_deg[orig_deg].second += deg*deg;
count[orig_deg]++;
}
}
......@@ -70,9 +70,9 @@ struct get_average_nearest_neighbours_correlation
size_t N = count[iter->first];
iter->second.first /= N;
if (N > 1)
iter->second.second = sqrt((iter->second.second - N*iter->second.first*iter->second.first)/(N*(N-1)));
iter->second.second = sqrt((iter->second.second - N*iter->second.first*iter->second.first)/(N*(N-1)));
else
iter->second.second = 0.0;
iter->second.second = 0.0;
}
}
DegreeSelectorOrigin& _origin_degree;
......@@ -98,11 +98,11 @@ struct choose_average_nearest_neighbours_correlation
{
if ( mpl::at<degree_selector_index, DegreeSelector>::type::value == _parent._neighbour_deg)
{
OriginDegreeSelector origin_deg(_parent._origin_deg_name, _parent._g);
DegreeSelector deg(_parent._neighbour_deg_name, _parent._g);
check_filter(_parent._g, bind<void>(get_average_nearest_neighbours_correlation<OriginDegreeSelector,DegreeSelector>(origin_deg, deg),
_1, var(_parent._avg_deg)),
reverse_check(),directed_check());
OriginDegreeSelector origin_deg(_parent._origin_deg_name, _parent._g);
DegreeSelector deg(_parent._neighbour_deg_name, _parent._g);
check_filter(_parent._g, bind<void>(get_average_nearest_neighbours_correlation<OriginDegreeSelector,DegreeSelector>(origin_deg, deg),