Commit 5c37ba28 authored by Tiago Peixoto's avatar Tiago Peixoto

Move remaining parallelism check out of the outer/inner loops and into the...

Move remaining parallelism check out of the outer/inner loops and into the parallel_check() function.
parent fb8200fe
...@@ -134,12 +134,15 @@ struct swap_edge_triad ...@@ -134,12 +134,15 @@ struct swap_edge_triad
s = source(e, g), // current source s = source(e, g), // current source
t = target(e, g), // current target t = target(e, g), // current target
ns = source(se, g), // new source ns = source(se, g), // new source
nt = target_in()(te, g), // new target nt = target_in()(te, g), // new target
te_s = source_in()(te, g), // target edge source te_s = source_in()(te, g), // target edge source
se_t = target(se, g); // source edge target se_t = target(se, g); // source edge target
if (edge_is_new[se] && (ns == s) && (nt == se_t))
return true; // e is parallel to se after swap
if (edge_is_new[te] && (te_s == ns) && (nt == t) ) if (edge_is_new[te] && (te_s == ns) && (nt == t) )
return true; // s is parallel to te after swap return true; // e is parallel to te after swap
if (edge_is_new[te] && edge_is_new[se] && (te != se) && if (edge_is_new[te] && edge_is_new[se] && (te != se) &&
(s == te_s) && (t == se_t)) (s == te_s) && (t == se_t))
return true; // se is parallel to te after swap return true; // se is parallel to te after swap
...@@ -412,9 +415,6 @@ public: ...@@ -412,9 +415,6 @@ public:
} }
if (!parallel_edges) // reject parallel edges if not allowed if (!parallel_edges) // reject parallel edges if not allowed
{ {
if(_edge_is_new[*esi] && (source(e, _g)==source(*esi, _g)) &&
(target(*esi, _g)==target_in()(*eti, _g)))
continue;
if (swap_edge_triad::parallel_check(e, *esi, *eti, if (swap_edge_triad::parallel_check(e, *esi, *eti,
_edge_is_new, _g)) _edge_is_new, _g))
continue; continue;
...@@ -448,7 +448,8 @@ public: ...@@ -448,7 +448,8 @@ public:
typedef typename graph_traits<Graph>::vertex_descriptor vertex_t; typedef typename graph_traits<Graph>::vertex_descriptor vertex_t;
typedef typename graph_traits<Graph>::edge_descriptor edge_t; typedef typename graph_traits<Graph>::edge_descriptor edge_t;
CorrelatedRewireStrategy (const Graph& g, EdgeIndexMap edge_index, rng_t& rng) CorrelatedRewireStrategy (const Graph& g, EdgeIndexMap edge_index,
rng_t& rng)
: _g(g), _rng(rng), _edge_is_new(edge_index) : _g(g), _rng(rng), _edge_is_new(edge_index)
{ {
int i, N = num_vertices(_g); int i, N = num_vertices(_g);
...@@ -528,13 +529,6 @@ public: ...@@ -528,13 +529,6 @@ public:
continue; continue;
} }
if(!parallel_edges) // reject parallel edges if not allowed
{
if(_edge_is_new[*out_vs_i] && (source(e, _g)==*vs) &&
(target(*out_vs_i, _g)==*vt))
continue;
}
random_edge_iter in_vt_i(in_edges_vt.begin(), random_edge_iter in_vt_i(in_edges_vt.begin(),
in_edges_vt.end(), random); in_edges_vt.end(), random);
for (; in_vt_i != in_edges_vt.end() && !found; ++in_vt_i) for (; in_vt_i != in_edges_vt.end() && !found; ++in_vt_i)
......
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