Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
graph-tool
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tiago Peixoto
graph-tool
Commits
5cd8d5c6
Commit
5cd8d5c6
authored
Jan 18, 2016
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid unnecessary testing for valid vertices in unfiltered graphs in parallel loops
parent
8c8323af
Changes
44
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
163 additions
and
146 deletions
+163
-146
src/graph/centrality/graph_betweenness.cc
src/graph/centrality/graph_betweenness.cc
+2
-2
src/graph/centrality/graph_closeness.hh
src/graph/centrality/graph_closeness.hh
+3
-6
src/graph/centrality/graph_eigentrust.hh
src/graph/centrality/graph_eigentrust.hh
+6
-6
src/graph/centrality/graph_eigenvector.hh
src/graph/centrality/graph_eigenvector.hh
+3
-3
src/graph/centrality/graph_hits.hh
src/graph/centrality/graph_hits.hh
+4
-4
src/graph/centrality/graph_katz.hh
src/graph/centrality/graph_katz.hh
+3
-3
src/graph/centrality/graph_pagerank.hh
src/graph/centrality/graph_pagerank.hh
+3
-3
src/graph/centrality/graph_trust_transitivity.hh
src/graph/centrality/graph_trust_transitivity.hh
+4
-4
src/graph/clustering/graph_clustering.hh
src/graph/clustering/graph_clustering.hh
+6
-6
src/graph/clustering/graph_extended_clustering.hh
src/graph/clustering/graph_extended_clustering.hh
+1
-1
src/graph/clustering/graph_motifs.hh
src/graph/clustering/graph_motifs.hh
+2
-2
src/graph/community/graph_blockmodel.hh
src/graph/community/graph_blockmodel.hh
+1
-1
src/graph/community/graph_community.hh
src/graph/community/graph_community.hh
+2
-2
src/graph/correlations/graph_assortativity.hh
src/graph/correlations/graph_assortativity.hh
+8
-8
src/graph/correlations/graph_avg_correlations.hh
src/graph/correlations/graph_avg_correlations.hh
+2
-2
src/graph/correlations/graph_corr_hist.hh
src/graph/correlations/graph_corr_hist.hh
+1
-1
src/graph/generation/graph_geometric.hh
src/graph/generation/graph_geometric.hh
+1
-1
src/graph/graph.cc
src/graph/graph.cc
+1
-1
src/graph/graph_adjacency.hh
src/graph/graph_adjacency.hh
+11
-6
src/graph/graph_copy.cc
src/graph/graph_copy.cc
+2
-2
src/graph/graph_filtering.hh
src/graph/graph_filtering.hh
+26
-0
src/graph/graph_properties.cc
src/graph/graph_properties.cc
+6
-7
src/graph/graph_properties_group.hh
src/graph/graph_properties_group.hh
+2
-2
src/graph/graph_properties_imp1.cc
src/graph/graph_properties_imp1.cc
+2
-2
src/graph/graph_properties_imp2.cc
src/graph/graph_properties_imp2.cc
+2
-2
src/graph/graph_python_interface.cc
src/graph/graph_python_interface.cc
+2
-2
src/graph/graph_selectors.hh
src/graph/graph_selectors.hh
+13
-20
src/graph/layout/graph_arf.hh
src/graph/layout/graph_arf.hh
+2
-2
src/graph/layout/graph_sfdp.cc
src/graph/layout/graph_sfdp.cc
+2
-2
src/graph/stats/graph_average.hh
src/graph/stats/graph_average.hh
+2
-2
src/graph/stats/graph_distance.hh
src/graph/stats/graph_distance.hh
+2
-2
src/graph/stats/graph_distance_sampled.hh
src/graph/stats/graph_distance_sampled.hh
+9
-12
src/graph/stats/graph_histograms.hh
src/graph/stats/graph_histograms.hh
+2
-2
src/graph/stats/graph_parallel.hh
src/graph/stats/graph_parallel.hh
+6
-6
src/graph/topology/graph_all_distances.cc
src/graph/topology/graph_all_distances.cc
+1
-1
src/graph/topology/graph_bipartite.cc
src/graph/topology/graph_bipartite.cc
+2
-2
src/graph/topology/graph_components.hh
src/graph/topology/graph_components.hh
+1
-1
src/graph/topology/graph_diameter.cc
src/graph/topology/graph_diameter.cc
+2
-2
src/graph/topology/graph_distance.cc
src/graph/topology/graph_distance.cc
+1
-1
src/graph/topology/graph_minimum_spanning_tree.cc
src/graph/topology/graph_minimum_spanning_tree.cc
+2
-2
src/graph/topology/graph_planar.cc
src/graph/topology/graph_planar.cc
+2
-2
src/graph/topology/graph_random_spanning_tree.cc
src/graph/topology/graph_random_spanning_tree.cc
+2
-2
src/graph/topology/graph_reciprocity.cc
src/graph/topology/graph_reciprocity.cc
+2
-2
src/graph/util/graph_search.hh
src/graph/util/graph_search.hh
+4
-4
No files found.
src/graph/centrality/graph_betweenness.cc
View file @
5cd8d5c6
...
...
@@ -48,8 +48,8 @@ void normalize_betweenness(const Graph& g,
schedule(runtime) if (N > 100)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
put
(
vertex_betweenness
,
v
,
vfactor
*
get
(
vertex_betweenness
,
v
));
}
...
...
src/graph/centrality/graph_closeness.hh
View file @
5cd8d5c6
...
...
@@ -72,17 +72,14 @@ struct get_closeness
for
(
i
=
0
;
i
<
N
;
++
i
)
{
vertex_t
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
unchecked_vector_property_map
<
val_type
,
VertexIndex
>
dist_map
(
vertex_index
,
num_vertices
(
g
));
for
(
int
j
=
0
;
j
<
N
;
++
j
)
{
if
(
vertex
(
j
,
g
)
!=
graph_traits
<
Graph
>::
null_vertex
())
dist_map
[
vertex
(
j
,
g
)]
=
numeric_limits
<
val_type
>::
max
();
}
for
(
auto
u
:
vertices_range
(
g
))
dist_map
[
u
]
=
numeric_limits
<
val_type
>::
max
();
dist_map
[
v
]
=
0
;
...
...
src/graph/centrality/graph_eigentrust.hh
View file @
5cd8d5c6
...
...
@@ -53,7 +53,7 @@ struct get_eigentrust
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
c_type
sum
=
0
;
...
...
@@ -77,7 +77,7 @@ struct get_eigentrust
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
c_sum
[
v
]
=
0
;
...
...
@@ -92,8 +92,8 @@ struct get_eigentrust
schedule(runtime) if (N > 100)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
t
[
v
]
=
1.0
/
V
;
}
...
...
@@ -108,7 +108,7 @@ struct get_eigentrust
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
t_temp
[
v
]
=
0
;
...
...
@@ -140,7 +140,7 @@ struct get_eigentrust
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
t
[
v
]
=
t_temp
[
v
];
}
...
...
src/graph/centrality/graph_eigenvector.hh
View file @
5cd8d5c6
...
...
@@ -64,7 +64,7 @@ struct get_eigenvector
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
c_temp
[
v
]
=
0
;
...
...
@@ -87,7 +87,7 @@ struct get_eigenvector
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
c_temp
[
v
]
/=
norm
;
delta
+=
abs
(
c_temp
[
v
]
-
c
[
v
]);
...
...
@@ -108,7 +108,7 @@ struct get_eigenvector
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
c
[
v
]
=
c_temp
[
v
];
}
...
...
src/graph/centrality/graph_hits.hh
View file @
5cd8d5c6
...
...
@@ -58,7 +58,7 @@ struct get_hits
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
x
[
v
]
=
1.0
/
V
;
y
[
v
]
=
1.0
/
V
;
...
...
@@ -76,7 +76,7 @@ struct get_hits
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
x_temp
[
v
]
=
0
;
...
...
@@ -109,7 +109,7 @@ struct get_hits
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
x_temp
[
v
]
/=
x_norm
;
y_temp
[
v
]
/=
y_norm
;
...
...
@@ -131,7 +131,7 @@ struct get_hits
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
x
[
v
]
=
x_temp
[
v
];
y
[
v
]
=
y_temp
[
v
];
...
...
src/graph/centrality/graph_katz.hh
View file @
5cd8d5c6
...
...
@@ -60,7 +60,7 @@ struct get_katz
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
c_temp
[
v
]
=
get
(
beta
,
v
);
...
...
@@ -81,7 +81,7 @@ struct get_katz
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
delta
+=
abs
(
c_temp
[
v
]
-
c
[
v
]);
}
...
...
@@ -99,7 +99,7 @@ struct get_katz
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
c_temp
[
v
]
=
c
[
v
];
}
...
...
src/graph/centrality/graph_pagerank.hh
View file @
5cd8d5c6
...
...
@@ -47,7 +47,7 @@ struct get_pagerank
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
put
(
deg
,
v
,
0
);
for
(
const
auto
&
e
:
out_edges_range
(
v
,
g
))
...
...
@@ -65,7 +65,7 @@ struct get_pagerank
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
rank_type
r
=
0
;
for
(
const
auto
&
e
:
in_or_out_edges_range
(
v
,
g
))
...
...
@@ -95,7 +95,7 @@ struct get_pagerank
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
put
(
rank
,
v
,
get
(
r_temp
,
v
));
}
...
...
src/graph/centrality/graph_trust_transitivity.hh
View file @
5cd8d5c6
...
...
@@ -108,7 +108,7 @@ struct get_trust_transitivity
for
(
i
=
0
;
i
<
N
;
++
i
)
{
vertex_t
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
t
[
v
].
resize
((
source
==
-
1
&&
target
==
-
1
)
?
N
:
1
);
}
...
...
@@ -118,7 +118,7 @@ struct get_trust_transitivity
for
(
i
=
(
target
==
-
1
)
?
0
:
target
;
i
<
N
;
++
i
)
{
vertex_t
tgt
=
vertex
(
i
,
g
);
if
(
tgt
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
tgt
,
g
))
continue
;
// mark the sources
...
...
@@ -212,7 +212,7 @@ struct get_trust_transitivity
for
(
j
=
0
;
j
<
N2
;
++
j
)
{
vertex_t
src
=
vertex
(
j
,
g
);
if
(
src
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
src
,
g
))
continue
;
t_type
weight
=
dist_map
[
src
];
sum_w
[
src
]
+=
weight
;
...
...
@@ -226,7 +226,7 @@ struct get_trust_transitivity
for
(
j
=
0
;
j
<
N2
;
++
j
)
{
vertex_t
src
=
vertex
(
j
,
g
);
if
(
src
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
src
,
g
))
continue
;
size_t
tidx
=
(
target
==
-
1
)
?
vertex_index
[
tgt
]
:
0
;
if
(
sum_w
[
src
]
>
0
)
...
...
src/graph/clustering/graph_clustering.hh
View file @
5cd8d5c6
...
...
@@ -102,8 +102,8 @@ struct get_global_clustering
schedule(runtime) if (N > 100) reduction(+:triangles, n)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
#ifdef USING_OPENMP
...
...
@@ -125,8 +125,8 @@ struct get_global_clustering
schedule(runtime) if (N > 100) reduction(+:cerr)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
#ifdef USING_OPENMP
...
...
@@ -167,8 +167,8 @@ struct set_clustering_to_property
schedule(runtime) if (N > 100)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
#ifdef USING_OPENMP
...
...
src/graph/clustering/graph_extended_clustering.hh
View file @
5cd8d5c6
...
...
@@ -125,7 +125,7 @@ struct get_extended_clustering
for
(
i
=
0
;
i
<
N
;
++
i
)
{
vertex_t
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
// We must disconsider paths through the original vertex
...
...
src/graph/clustering/graph_motifs.hh
View file @
5cd8d5c6
...
...
@@ -277,7 +277,7 @@ void get_sig(Graph& g, std::vector<size_t>& sig)
sig
.
resize
(
is_directed
::
apply
<
Graph
>::
type
::
value
?
2
*
N
:
N
);
for
(
size_t
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
auto
v
=
vertex
(
i
,
g
);
sig
[
i
]
=
out_degree
(
v
,
g
);
if
(
is_directed
::
apply
<
Graph
>::
type
::
value
)
sig
[
i
+
N
]
=
in_degreeS
()(
v
,
g
);
...
...
@@ -363,7 +363,7 @@ struct get_all_motifs
subgraphs
;
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
(
p
<
1
)
?
V
[
i
]
:
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
typename
wrap_undirected
::
apply
<
Graph
>::
type
ug
(
g
);
...
...
src/graph/community/graph_blockmodel.hh
View file @
5cd8d5c6
...
...
@@ -2680,7 +2680,7 @@ void move_sweep(vector<BlockState>& states, vector<MEntries>& m_entries_r,
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
for
(
auto
e
:
out_edges_range
(
v
,
g
))
E
+=
eweight
[
e
];
...
...
src/graph/community/graph_community.hh
View file @
5cd8d5c6
...
...
@@ -107,7 +107,7 @@ struct get_communities
for
(
i
=
0
;
i
<
NV
;
++
i
)
{
vertex_t
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
size_t
new_s
;
...
...
@@ -209,7 +209,7 @@ struct get_communities
for
(
i
=
0
;
i
<
NV
;
++
i
)
{
vertex_t
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
temp_s
[
v
]
=
s
[
v
];
}
...
...
src/graph/correlations/graph_assortativity.hh
View file @
5cd8d5c6
...
...
@@ -54,8 +54,8 @@ struct get_assortativity_coefficient
schedule(runtime) if (N > 100) reduction(+:e_kk, n_edges)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
val_t
k1
=
deg
(
v
,
g
);
...
...
@@ -91,8 +91,8 @@ struct get_assortativity_coefficient
reduction(+:err)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
val_t
k1
=
deg
(
v
,
g
);
...
...
@@ -135,8 +135,8 @@ struct get_scalar_assortativity_coefficient
schedule(runtime) if (N > 100) reduction(+:e_xy,n_edges,a,b,da,db)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
double
k1
=
double
(
deg
(
v
,
g
));
...
...
@@ -172,8 +172,8 @@ struct get_scalar_assortativity_coefficient
reduction(+:err)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
double
k1
=
double
(
deg
(
v
,
g
));
...
...
src/graph/correlations/graph_avg_correlations.hh
View file @
5cd8d5c6
...
...
@@ -70,8 +70,8 @@ struct get_avg_correlation
firstprivate(s_sum, s_sum2, s_count) schedule(runtime) if (N > 100)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
put_point
(
v
,
deg1
,
deg2
,
g
,
weight
,
s_sum
,
s_sum2
,
s_count
);
}
...
...
src/graph/correlations/graph_corr_hist.hh
View file @
5cd8d5c6
...
...
@@ -65,7 +65,7 @@ struct get_correlation_histogram
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
put_point
(
v
,
deg1
,
deg2
,
g
,
weight
,
s_hist
);
}
...
...
src/graph/generation/graph_geometric.hh
View file @
5cd8d5c6
...
...
@@ -137,7 +137,7 @@ struct get_geometric
schedule(runtime) if (N > 100)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
auto
v
=
vertex
(
i
,
g
);
get_box
(
points
[
i
],
w
,
box
,
ranges
,
periodic_boundary
);
for
(
int
k
=
0
;
k
<
power
(
3
,
int
(
box
.
size
()));
++
k
)
...
...
src/graph/graph.cc
View file @
5cd8d5c6
...
...
@@ -87,7 +87,7 @@ struct clear_vertices
for
(
int
i
=
N
-
1
;
i
>=
0
;
--
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
remove_vertex
(
v
,
g
);
}
...
...
src/graph/graph_adjacency.hh
View file @
5cd8d5c6
...
...
@@ -574,8 +574,10 @@ out_edges(Vertex v, const adj_list<Vertex>& g)
{
typedef
typename
adj_list
<
Vertex
>::
out_edge_iterator
ei_t
;
typedef
typename
adj_list
<
Vertex
>::
make_out_edge
mk_edge
;
return
std
::
make_pair
(
ei_t
(
g
.
_out_edges
[
v
].
begin
(),
mk_edge
(
v
)),
ei_t
(
g
.
_out_edges
[
v
].
end
(),
mk_edge
(
v
)));
auto
&
edges
=
g
.
_out_edges
[
v
];
auto
mke
=
mk_edge
(
v
);
return
std
::
make_pair
(
ei_t
(
edges
.
begin
(),
mke
),
ei_t
(
edges
.
end
(),
mke
));
}
template
<
class
Vertex
>
...
...
@@ -586,8 +588,10 @@ in_edges(Vertex v, const adj_list<Vertex>& g)
{
typedef
typename
adj_list
<
Vertex
>::
in_edge_iterator
ei_t
;
typedef
typename
adj_list
<
Vertex
>::
make_in_edge
mk_edge
;
return
std
::
make_pair
(
ei_t
(
g
.
_in_edges
[
v
].
begin
(),
mk_edge
(
v
)),
ei_t
(
g
.
_in_edges
[
v
].
end
(),
mk_edge
(
v
)));
auto
&
edges
=
g
.
_in_edges
[
v
];
auto
mke
=
mk_edge
(
v
);
return
std
::
make_pair
(
ei_t
(
edges
.
begin
(),
mke
),
ei_t
(
edges
.
end
(),
mke
));
}
template
<
class
Vertex
>
...
...
@@ -597,8 +601,9 @@ std::pair<typename adj_list<Vertex>::adjacency_iterator,
adjacent_vertices
(
Vertex
v
,
const
adj_list
<
Vertex
>&
g
)
{
typedef
typename
adj_list
<
Vertex
>::
adjacency_iterator
ai_t
;
return
std
::
make_pair
(
ai_t
(
g
.
_out_edges
[
v
].
begin
()),
ai_t
(
g
.
_out_edges
[
v
].
end
()));
auto
&
edges
=
g
.
_out_edges
[
v
];
return
std
::
make_pair
(
ai_t
(
edges
.
begin
()),
ai_t
(
edges
.
end
()));
}
template
<
class
Vertex
>
...
...
src/graph/graph_copy.cc
View file @
5cd8d5c6
...
...
@@ -75,7 +75,7 @@ struct copy_vertex_property_dispatch
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
src
);
if
(
v
==
graph_traits
<
GraphSrc
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
src
))
continue
;
auto
new_v
=
vertex
(
index_map
[
i
],
tgt
);
p_tgt
[
new_v
]
=
p_src
[
v
];
...
...
@@ -146,7 +146,7 @@ struct copy_edge_property_dispatch
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
src
);
if
(
v
==
graph_traits
<
GraphSrc
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
src
))
continue
;
for
(
auto
e
:
out_edges_range
(
v
,
src
))
...
...
src/graph/graph_filtering.hh
View file @
5cd8d5c6
...
...
@@ -581,6 +581,32 @@ add_edge(Vertex s, Vertex t, filtered_graph<Graph,
return
e
;
}
// Used to skip filtered vertices
template
<
class
Graph
,
class
EdgePred
,
class
VertexPred
,
class
Vertex
>
bool
is_valid_vertex
(
Vertex
v
,
const
boost
::
filtered_graph
<
Graph
,
EdgePred
,
VertexPred
>&
)
{
return
v
!=
graph_traits
<
boost
::
filtered_graph
<
Graph
,
EdgePred
,
VertexPred
>>::
null_vertex
();
}
template
<
class
Graph
,
class
Vertex
>
bool
is_valid_vertex
(
Vertex
,
const
Graph
&
)
{
return
true
;
}
template
<
class
Graph
,
class
Vertex
>
bool
is_valid_vertex
(
Vertex
v
,
const
boost
::
reverse_graph
<
Graph
>&
g
)
{
return
is_valid_vertex
(
v
,
g
.
m_g
);
}
template
<
class
Graph
,
class
Vertex
>
bool
is_valid_vertex
(
Vertex
v
,
const
boost
::
UndirectedAdaptor
<
Graph
>&
g
)
{
return
is_valid_vertex
(
v
,
g
.
original_graph
());
}
}
// namespace boost
...
...
src/graph/graph_properties.cc
View file @
5cd8d5c6
...
...
@@ -186,7 +186,7 @@ struct do_infect_vertex_property
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
if
(
!
all
&&
vals
.
find
(
prop
[
v
])
==
vals
.
end
())
continue
;
...
...
@@ -203,7 +203,7 @@ struct do_infect_vertex_property
for
(
i
=
0
;
i
<
N
;
++
i
)
{
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
if
(
marked
[
v
])
prop
[
v
]
=
temp
[
v
];
...
...
@@ -239,12 +239,11 @@ struct do_mark_edges
schedule(runtime) if (N > 100)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
typename
graph_traits
<
Graph
>::
out_edge_iterator
e
,
e_end
;
for
(
tie
(
e
,
e_end
)
=
out_edges
(
v
,
g
);
e
!=
e_end
;
++
e
)
prop
[
*
e
]
=
true
;
for
(
auto
e
:
out_edges_range
(
v
,
g
))
prop
[
e
]
=
true
;
}
}
};
...
...
src/graph/graph_properties_group.hh
View file @
5cd8d5c6
...
...
@@ -33,8 +33,8 @@ struct do_group_vector_property
#pragma omp parallel for default(shared) private(i)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
boost
::
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
boost
::
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
dispatch_descriptor
(
g
,
vector_map
,
map
,
v
,
pos
,
Edge
());
}
...
...
src/graph/graph_properties_imp1.cc
View file @
5cd8d5c6
...
...
@@ -46,8 +46,8 @@ struct do_edge_endpoint
schedule(runtime) if (N > 100)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
for
(
const
auto
&
e
:
out_edges_range
(
v
,
g
))
{
...
...
src/graph/graph_properties_imp2.cc
View file @
5cd8d5c6
...
...
@@ -165,8 +165,8 @@ struct do_out_edges_op
schedule(runtime) if (N > 100)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
op
(
v
,
eprop
,
vprop
,
g
);
}
...
...
src/graph/graph_python_interface.cc
View file @
5cd8d5c6
...
...
@@ -312,8 +312,8 @@ struct get_degree_map
#pragma omp parallel for default(shared) private(i) schedule(runtime) if (N > 100)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
(
))
auto
v
=
vertex
(
i
,
g
);
if
(
!
is_valid_vertex
(
v
,
g
))
continue
;
deg_map
[
v
]
=
deg
(
v
,
g
,
weight
);
}
...
...
src/graph/graph_selectors.hh
View file @
5cd8d5c6
...
...
@@ -483,68 +483,61 @@ private:
template
<
class
Iter
>
inline
IterRange
<
Iter
>
mk_range
(
std
::
pair
<
Iter
,
Iter
>&&
range
)
auto
mk_range
(
std
::
pair
<
Iter
,
Iter
>&&
range
)
{
return
IterRange
<
Iter
>
(
std
::
forward
<
std
::
pair
<<