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
43
Issues
43
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
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
70a2ce29
Commit
70a2ce29
authored
Jun 03, 2012
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some compilation issues and warnings with clang
parent
b2b27965
Changes
30
Hide whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
180 additions
and
157 deletions
+180
-157
src/boost-workaround/boost/graph/betweenness_centrality.hpp
src/boost-workaround/boost/graph/betweenness_centrality.hpp
+22
-22
src/boost-workaround/boost/graph/isomorphism.hpp
src/boost-workaround/boost/graph/isomorphism.hpp
+13
-13
src/graph/Makefile.am
src/graph/Makefile.am
+1
-0
src/graph/centrality/graph_betweenness.cc
src/graph/centrality/graph_betweenness.cc
+1
-1
src/graph/centrality/graph_eigentrust.hh
src/graph/centrality/graph_eigentrust.hh
+1
-2
src/graph/centrality/graph_eigenvector.cc
src/graph/centrality/graph_eigenvector.cc
+1
-2
src/graph/centrality/graph_eigenvector.hh
src/graph/centrality/graph_eigenvector.hh
+5
-7
src/graph/centrality/graph_pagerank.hh
src/graph/centrality/graph_pagerank.hh
+1
-2
src/graph/centrality/graph_trust_transitivity.cc
src/graph/centrality/graph_trust_transitivity.cc
+1
-2
src/graph/centrality/graph_trust_transitivity.hh
src/graph/centrality/graph_trust_transitivity.hh
+5
-7
src/graph/clustering/graph_clustering.hh
src/graph/clustering/graph_clustering.hh
+2
-1
src/graph/clustering/graph_motifs.cc
src/graph/clustering/graph_motifs.cc
+1
-1
src/graph/clustering/graph_motifs.hh
src/graph/clustering/graph_motifs.hh
+4
-4
src/graph/community/graph_community.cc
src/graph/community/graph_community.cc
+2
-3
src/graph/community/graph_community.hh
src/graph/community/graph_community.hh
+16
-16
src/graph/community/graph_community_network.cc
src/graph/community/graph_community_network.cc
+2
-2
src/graph/community/graph_community_network.hh
src/graph/community/graph_community_network.hh
+13
-15
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
+1
-1
src/graph/correlations/graph_correlations.hh
src/graph/correlations/graph_correlations.hh
+3
-2
src/graph/fast_vector_property_map.hh
src/graph/fast_vector_property_map.hh
+4
-4
src/graph/graph_exceptions.cc
src/graph/graph_exceptions.cc
+32
-0
src/graph/graph_exceptions.hh
src/graph/graph_exceptions.hh
+10
-7
src/graph/graph_properties.hh
src/graph/graph_properties.hh
+10
-11
src/graph/graph_selectors.hh
src/graph/graph_selectors.hh
+4
-4
src/graph/graph_util.hh
src/graph/graph_util.hh
+2
-2
src/graph/graph_wrap.hh
src/graph/graph_wrap.hh
+9
-9
src/graph/histogram.hh
src/graph/histogram.hh
+1
-1
src/graph/layout/graph_sfdp.hh
src/graph/layout/graph_sfdp.hh
+2
-2
src/graph_tool/community/__init__.py
src/graph_tool/community/__init__.py
+3
-6
No files found.
src/boost-workaround/boost/graph/betweenness_centrality.hpp
View file @
70a2ce29
...
...
@@ -51,14 +51,14 @@ namespace detail { namespace graph {
typedef
typename
graph_traits
<
Graph
>::
vertex_descriptor
vertex_descriptor
;
typedef
typename
graph_traits
<
Graph
>::
edge_descriptor
edge_descriptor
;
brandes_dijkstra_visitor
(
std
::
stack
<
vertex_descriptor
>&
ordered_vertices
,
WeightMap
weight
,
IncomingMap
incoming
,
DistanceMap
distance
,
PathCountMap
path_count
)
:
ordered_vertices
(
ordered_vertices
),
weight
(
weight
),
incoming
(
i
ncoming
),
distance
(
distance
),
path_count
(
path_count
)
brandes_dijkstra_visitor
(
std
::
stack
<
vertex_descriptor
>&
i
ordered_vertices
,
WeightMap
i
weight
,
IncomingMap
i
i
ncoming
,
DistanceMap
i
distance
,
PathCountMap
i
path_count
)
:
ordered_vertices
(
iordered_vertices
),
weight
(
i
weight
),
incoming
(
i
incoming
),
distance
(
i
distance
),
path_count
(
i
path_count
)
{
}
/**
...
...
@@ -117,8 +117,8 @@ namespace detail { namespace graph {
template
<
typename
WeightMap
>
struct
brandes_dijkstra_shortest_paths
{
brandes_dijkstra_shortest_paths
(
WeightMap
weight_map
)
:
weight_map
(
weight_map
)
{
}
brandes_dijkstra_shortest_paths
(
WeightMap
i
weight_map
)
:
weight_map
(
i
weight_map
)
{
}
template
<
typename
Graph
,
typename
IncomingMap
,
typename
DistanceMap
,
typename
PathCountMap
,
typename
VertexIndexMap
>
...
...
@@ -165,11 +165,11 @@ namespace detail { namespace graph {
typedef
typename
graph_traits
<
Graph
>::
vertex_descriptor
vertex_descriptor
;
visitor_type
(
IncomingMap
i
ncoming
,
DistanceMap
distance
,
PathCountMap
path_count
,
std
::
stack
<
vertex_descriptor
>&
ordered_vertices
)
:
incoming
(
i
ncoming
),
distance
(
distance
),
path_count
(
path_count
),
ordered_vertices
(
ordered_vertices
)
{
}
visitor_type
(
IncomingMap
i
incoming
,
DistanceMap
i
distance
,
PathCountMap
i
path_count
,
std
::
stack
<
vertex_descriptor
>&
i
ordered_vertices
)
:
incoming
(
i
incoming
),
distance
(
i
distance
),
path_count
(
ipath_count
),
ordered_vertices
(
i
ordered_vertices
)
{
}
/// Keep track of vertices as they are reached
void
examine_vertex
(
vertex_descriptor
v
,
Graph
&
)
...
...
@@ -344,7 +344,7 @@ namespace detail { namespace graph {
while
(
!
ordered_vertices
.
empty
())
{
vertex_descriptor
w
=
ordered_vertices
.
top
();
vertex_descriptor
u
=
ordered_vertices
.
top
();
ordered_vertices
.
pop
();
typedef
typename
property_traits
<
IncomingMap
>::
value_type
...
...
@@ -353,18 +353,18 @@ namespace detail { namespace graph {
typedef
typename
property_traits
<
DependencyMap
>::
value_type
dependency_type
;
for
(
incoming_iterator
vw
=
incoming
[
w
].
begin
();
vw
!=
incoming
[
w
].
end
();
++
vw
)
{
for
(
incoming_iterator
vw
=
incoming
[
u
].
begin
();
vw
!=
incoming
[
u
].
end
();
++
vw
)
{
vertex_descriptor
v
=
source
(
*
vw
,
g
);
dependency_type
factor
=
dependency_type
(
get
(
path_count
,
v
))
/
dependency_type
(
get
(
path_count
,
w
));
factor
*=
(
dependency_type
(
1
)
+
get
(
dependency
,
w
));
/
dependency_type
(
get
(
path_count
,
u
));
factor
*=
(
dependency_type
(
1
)
+
get
(
dependency
,
u
));
put
(
dependency
,
v
,
get
(
dependency
,
v
)
+
factor
);
update_centrality
(
edge_centrality_map
,
*
vw
,
factor
);
}
if
(
w
!=
s
)
{
update_centrality
(
centrality
,
w
,
get
(
dependency
,
w
));
if
(
u
!=
s
)
{
update_centrality
(
centrality
,
u
,
get
(
dependency
,
u
));
}
}
...
...
src/boost-workaround/boost/graph/isomorphism.hpp
View file @
70a2ce29
...
...
@@ -85,8 +85,8 @@ namespace boost {
friend
struct
compare_multiplicity
;
struct
compare_multiplicity
{
compare_multiplicity
(
Invariant1
inv
ariant1
,
size_type
*
multiplicity
)
:
invariant1
(
inv
ariant1
),
multiplicity
(
multiplicity
)
{
}
compare_multiplicity
(
Invariant1
inv
1
,
size_type
*
mult
)
:
invariant1
(
inv
1
),
multiplicity
(
mult
)
{
}
bool
operator
()(
const
vertex1_t
&
x
,
const
vertex1_t
&
y
)
const
{
return
multiplicity
[
invariant1
(
x
)]
<
multiplicity
[
invariant1
(
y
)];
}
...
...
@@ -102,7 +102,7 @@ namespace boost {
void
discover_vertex
(
vertex1_t
v
,
const
Graph1
&
)
const
{
vertices
.
push_back
(
v
);
}
void
examine_edge
(
edge1_t
e
,
const
Graph1
&
G1
)
const
{
void
examine_edge
(
edge1_t
e
,
const
Graph1
&
)
const
{
edges
.
push_back
(
e
);
}
std
::
vector
<
vertex1_t
>&
vertices
;
...
...
@@ -110,8 +110,8 @@ namespace boost {
};
struct
edge_cmp
{
edge_cmp
(
const
Graph1
&
G
1
,
DFSNumMap
dfs_num
)
:
G1
(
G
1
),
dfs_num
(
dfs_num
)
{
}
edge_cmp
(
const
Graph1
&
G
r1
,
DFSNumMap
dfs_n
)
:
G1
(
G
r1
),
dfs_num
(
dfs_n
)
{
}
bool
operator
()(
const
edge1_t
&
e1
,
const
edge1_t
&
e2
)
const
{
using
namespace
std
;
int
u1
=
dfs_num
[
source
(
e1
,
G1
)],
v1
=
dfs_num
[
target
(
e1
,
G1
)];
...
...
@@ -127,12 +127,12 @@ namespace boost {
};
public:
isomorphism_algo
(
const
Graph1
&
G
1
,
const
Graph2
&
G2
,
IsoMapping
f
,
Invariant1
inv
ariant1
,
Invariant2
invariant2
,
std
::
size_t
max_invariant
,
IndexMap1
index
_map1
,
IndexMap2
index_map
2
)
:
G1
(
G
1
),
G2
(
G2
),
f
(
f
),
invariant1
(
invariant1
),
invariant2
(
invariant
2
),
max_invariant
(
max_inv
ariant
),
index_map1
(
index
_map1
),
index_map2
(
index_map
2
)
isomorphism_algo
(
const
Graph1
&
G
G1
,
const
Graph2
&
GG2
,
IsoMapping
m
f
,
Invariant1
inv
1
,
Invariant2
inv2
,
std
::
size_t
max_inv
,
IndexMap1
index
1
,
IndexMap2
index
2
)
:
G1
(
G
G1
),
G2
(
GG2
),
f
(
mf
),
invariant1
(
inv1
),
invariant2
(
inv
2
),
max_invariant
(
max_inv
),
index_map1
(
index
1
),
index_map2
(
index
2
)
{
in_S_vec
.
resize
(
num_vertices
(
G1
));
in_S
=
make_safe_iterator_property_map
...
...
@@ -236,8 +236,8 @@ namespace boost {
count_if
(
adjacent_vertices
(
f
[
k
],
G2
),
make_indirect_pmap
(
in_S
));
for
(
int
jj
=
0
;
jj
<
dfs_num_k
;
++
jj
)
{
vertex1_t
j
=
dfs_vertices
[
jj
];
num_edges_on_k
-=
count
(
adjacent_vertices
(
f
[
j
],
G2
),
f
[
k
]);
vertex1_t
v
j
=
dfs_vertices
[
jj
];
num_edges_on_k
-=
count
(
adjacent_vertices
(
f
[
v
j
],
G2
),
f
[
k
]);
}
if
(
num_edges_on_k
!=
0
)
...
...
src/graph/Makefile.am
View file @
70a2ce29
...
...
@@ -19,6 +19,7 @@ libgraph_tool_core_LTLIBRARIES = libgraph_tool_core.la
libgraph_tool_core_la_SOURCES
=
\
graph.cc
\
graph_exceptions.cc
\
graph_bind.cc
\
graph_copy.cc
\
graph_filtering.cc
\
...
...
src/graph/centrality/graph_betweenness.cc
View file @
70a2ce29
...
...
@@ -162,7 +162,7 @@ struct get_central_point_dominance
void
operator
()(
Graph
&
g
,
VertexBetweenness
vertex_betweenness
,
double
&
c
)
const
{
c
=
central_point_dominance
(
g
,
vertex_betweenness
);
c
=
double
(
central_point_dominance
(
g
,
vertex_betweenness
)
);
}
};
...
...
src/graph/centrality/graph_eigentrust.hh
View file @
70a2ce29
...
...
@@ -104,7 +104,6 @@ struct get_eigentrust
while
(
delta
>=
epslon
)
{
delta
=
0
;
int
i
,
N
=
num_vertices
(
g
);
#pragma omp parallel for default(shared) private(i) \
schedule(dynamic) reduction(+:delta)
for
(
i
=
0
;
i
<
N
;
++
i
)
...
...
@@ -139,7 +138,7 @@ struct get_eigentrust
{
#pragma omp parallel for default(shared) private(i) \
schedule(dynamic)
for
(
i
nt
i
=
0
;
i
<
N
;
++
i
)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
...
...
src/graph/centrality/graph_eigenvector.cc
View file @
70a2ce29
...
...
@@ -46,8 +46,7 @@ long double eigenvector(GraphInterface& g, boost::any w, boost::any c,
long
double
eig
=
0
;
run_action
<>
()
(
g
,
bind
<
void
>
(
get_eigenvector
(),
_1
,
g
.
GetVertexIndex
(),
g
.
GetEdgeIndex
(),
_2
,
(
get_eigenvector
(),
_1
,
g
.
GetEdgeIndex
(),
_2
,
_3
,
epsilon
,
max_iter
,
ref
(
eig
)),
weight_props_t
(),
vertex_floating_properties
())(
w
,
c
);
...
...
src/graph/centrality/graph_eigenvector.hh
View file @
70a2ce29
...
...
@@ -32,11 +32,11 @@ using namespace boost;
struct
get_eigenvector
{
template
<
class
Graph
,
class
VertexIndex
,
class
EdgeIndex
,
class
WeightMap
,
template
<
class
Graph
,
class
VertexIndex
,
class
WeightMap
,
class
CentralityMap
>
void
operator
()(
Graph
&
g
,
VertexIndex
vertex_index
,
EdgeIndex
edge_index
,
WeightMap
w
,
CentralityMap
c
,
double
epsilon
,
size_t
max_iter
,
long
double
&
eig
)
const
void
operator
()(
Graph
&
g
,
VertexIndex
vertex_index
,
WeightMap
w
,
CentralityMap
c
,
double
epsilon
,
size_t
max_iter
,
long
double
&
eig
)
const
{
typedef
typename
property_traits
<
WeightMap
>::
value_type
c_type
;
typedef
typename
property_traits
<
CentralityMap
>::
value_type
t_type
;
...
...
@@ -57,13 +57,11 @@ struct get_eigenvector
t_type
norm
=
0
;
t_type
delta
=
epsilon
+
1
;
size_t
iter
=
0
;
while
(
delta
>=
epsilon
)
{
norm
=
0
;
int
i
,
N
=
num_vertices
(
g
);
#pragma omp parallel for default(shared) private(i) \
schedule(dynamic) reduction(+:norm)
for
(
i
=
0
;
i
<
N
;
++
i
)
...
...
@@ -109,7 +107,7 @@ struct get_eigenvector
{
#pragma omp parallel for default(shared) private(i) \
schedule(dynamic)
for
(
i
nt
i
=
0
;
i
<
N
;
++
i
)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
...
...
src/graph/centrality/graph_pagerank.hh
View file @
70a2ce29
...
...
@@ -63,7 +63,6 @@ struct get_pagerank
while
(
delta
>=
epsilon
)
{
delta
=
0
;
int
i
,
N
=
num_vertices
(
g
);
#pragma omp parallel for default(shared) private(i) \
schedule(dynamic) reduction(+:delta)
for
(
i
=
0
;
i
<
N
;
++
i
)
...
...
@@ -97,7 +96,7 @@ struct get_pagerank
{
#pragma omp parallel for default(shared) private(i) \
schedule(dynamic)
for
(
i
nt
i
=
0
;
i
<
N
;
++
i
)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
...
...
src/graph/centrality/graph_trust_transitivity.cc
View file @
70a2ce29
...
...
@@ -38,8 +38,7 @@ void trust_transitivity(GraphInterface& g, int64_t source, int64_t target,
run_action
<>
()(
g
,
bind
<
void
>
(
get_trust_transitivity
(),
_1
,
g
.
GetVertexIndex
(),
g
.
GetEdgeIndex
(),
g
.
GetMaxEdgeIndex
(),
source
,
target
,
_2
,
_3
),
source
,
target
,
_2
,
_3
),
edge_floating_properties
(),
vertex_floating_vector_properties
())(
c
,
t
);
}
...
...
src/graph/centrality/graph_trust_transitivity.hh
View file @
70a2ce29
...
...
@@ -47,7 +47,7 @@ public:
template
<
class
Graph
>
void
examine_vertex
(
typename
graph_traits
<
Graph
>::
vertex_descriptor
u
,
Graph
&
g
)
Graph
&
)
{
// stop if all sources are found
if
(
_source_map
[
u
])
...
...
@@ -78,7 +78,7 @@ struct dist_combine
template
<
class
DistType
,
class
WeightType
>
DistType
operator
()(
const
DistType
&
d
,
const
WeightType
&
w
)
const
{
return
d
*
w
;
return
DistType
(
d
*
w
)
;
}
};
...
...
@@ -94,12 +94,10 @@ struct filter_vertex_pred
struct
get_trust_transitivity
{
template
<
class
Graph
,
class
VertexIndex
,
class
EdgeIndex
,
class
TrustMap
,
template
<
class
Graph
,
class
VertexIndex
,
class
TrustMap
,
class
InferredTrustMap
>
void
operator
()(
Graph
&
g
,
VertexIndex
vertex_index
,
EdgeIndex
edge_index
,
size_t
max_edge_index
,
int64_t
source
,
int64_t
target
,
TrustMap
c
,
InferredTrustMap
t
)
const
void
operator
()(
Graph
&
g
,
VertexIndex
vertex_index
,
int64_t
source
,
int64_t
target
,
TrustMap
c
,
InferredTrustMap
t
)
const
{
typedef
typename
graph_traits
<
Graph
>::
vertex_descriptor
vertex_t
;
typedef
typename
graph_traits
<
Graph
>::
edge_descriptor
edge_t
;
...
...
src/graph/clustering/graph_clustering.hh
View file @
70a2ce29
...
...
@@ -142,6 +142,7 @@ struct set_clustering_to_property
template
<
class
Graph
,
class
ClustMap
>
void
operator
()(
const
Graph
&
g
,
ClustMap
clust_map
)
const
{
typedef
typename
property_traits
<
ClustMap
>::
value_type
c_type
;
typename
get_undirected_graph
<
Graph
>::
type
ug
(
g
);
int
i
,
N
=
num_vertices
(
g
);
...
...
@@ -159,7 +160,7 @@ struct set_clustering_to_property
#pragma omp critical
{
clust_map
[
v
]
=
c
lustering
;
clust_map
[
v
]
=
c
_type
(
clustering
)
;
}
}
}
...
...
src/graph/clustering/graph_motifs.cc
View file @
70a2ce29
...
...
@@ -32,7 +32,7 @@ using namespace graph_tool;
struct
null_copy
{
template
<
class
T1
,
class
T2
>
void
operator
()(
const
T1
&
t1
,
const
T2
&
t2
)
const
{}
void
operator
()(
const
T1
&
,
const
T2
&
)
const
{}
};
struct
append_to_list
...
...
src/graph/clustering/graph_motifs.hh
View file @
70a2ce29
...
...
@@ -172,9 +172,9 @@ struct sample_some
r
=
random
();
}
if
(
r
<
u
)
n
=
ceil
(
nc
*
pd
);
n
=
size_t
(
ceil
(
nc
*
pd
)
);
else
n
=
floor
(
nc
*
pd
);
n
=
size_t
(
floor
(
nc
*
pd
)
);
if
(
n
==
extend
.
size
())
return
;
...
...
@@ -339,9 +339,9 @@ struct get_all_motifs
size_t
n
;
if
(
random
()
<
p
)
n
=
ceil
(
V
.
size
()
*
p
);
n
=
size_t
(
ceil
(
V
.
size
()
*
p
)
);
else
n
=
floor
(
V
.
size
()
*
p
);
n
=
size_t
(
floor
(
V
.
size
()
*
p
)
);
typedef
tr1
::
uniform_int
<
size_t
>
idist_t
;
for
(
size_t
i
=
0
;
i
<
n
;
++
i
)
...
...
src/graph/community/graph_community.cc
View file @
70a2ce29
...
...
@@ -33,9 +33,8 @@ using namespace graph_tool;
void
community_structure
(
GraphInterface
&
g
,
double
gamma
,
string
corr_name
,
size_t
n_iter
,
double
Tmin
,
double
Tmax
,
size_t
Nspins
,
bool
new_spins
,
size_t
seed
,
bool
verbose
,
string
history_file
,
boost
::
any
weight
,
boost
::
any
property
)
size_t
seed
,
bool
verbose
,
string
history_file
,
boost
::
any
weight
,
boost
::
any
property
)
{
typedef
property_map_types
::
apply
<
mpl
::
vector
<
int32_t
,
int64_t
>
,
GraphInterface
::
vertex_index_map_t
,
...
...
src/graph/community/graph_community.hh
View file @
70a2ce29
...
...
@@ -90,11 +90,11 @@ struct get_communities
// init spins from [0,N-1] and global info
tr1
::
uniform_int
<
size_t
>
sample_spin
(
0
,
n_spins
-
1
);
typename
graph_traits
<
Graph
>::
vertex_iterator
v
,
v
_end
;
for
(
tie
(
v
,
v_end
)
=
vertices
(
g
);
v
!=
v_end
;
++
v
)
typename
graph_traits
<
Graph
>::
vertex_iterator
v
i
,
vi
_end
;
for
(
tie
(
v
i
,
vi_end
)
=
vertices
(
g
);
vi
!=
vi_end
;
++
vi
)
{
s
[
*
v
]
=
temp_s
[
*
v
]
=
sample_spin
(
rng
);
Ns
[
s
[
*
v
]]
++
;
s
[
*
v
i
]
=
temp_s
[
*
vi
]
=
sample_spin
(
rng
);
Ns
[
s
[
*
v
i
]]
++
;
}
NNKS
<
Graph
,
CommunityMap
>
Nnnks
(
g
,
s
);
// this will retrieve the expected
...
...
@@ -233,11 +233,11 @@ struct get_communities
// rename spins, starting from zero
unordered_map
<
size_t
,
size_t
>
spins
;
for
(
tie
(
v
,
v_end
)
=
vertices
(
g
);
v
!=
v_end
;
++
v
)
for
(
tie
(
v
i
,
vi_end
)
=
vertices
(
g
);
vi
!=
vi_end
;
++
vi
)
{
if
(
spins
.
find
(
s
[
*
v
])
==
spins
.
end
())
spins
[
s
[
*
v
]]
=
spins
.
size
()
-
1
;
s
[
*
v
]
=
spins
[
s
[
*
v
]];
if
(
spins
.
find
(
s
[
*
v
i
])
==
spins
.
end
())
spins
[
s
[
*
v
i
]]
=
spins
.
size
()
-
1
;
s
[
*
v
i
]
=
spins
[
s
[
*
vi
]];
}
}
...
...
@@ -262,7 +262,7 @@ public:
_p
=
_avg_k
/
(
N
*
N
);
}
void
Update
(
size_t
k
,
size_t
old_s
,
size_t
s
)
void
Update
(
size_t
,
size_t
old_s
,
size_t
s
)
{
_Ns
[
old_s
]
--
;
if
(
_Ns
[
old_s
]
==
0
)
...
...
@@ -270,7 +270,7 @@ public:
_Ns
[
s
]
++
;
}
double
operator
()(
size_t
k
,
size_t
s
)
const
double
operator
()(
size_t
,
size_t
s
)
const
{
size_t
ns
=
0
;
typeof
(
_Ns
.
begin
())
iter
=
_Ns
.
find
(
s
);
...
...
@@ -343,14 +343,14 @@ public:
typename
graph_traits
<
Graph
>::
edge_iterator
e
,
e_end
;
for
(
tie
(
e
,
e_end
)
=
edges
(
_g
);
e
!=
e_end
;
++
e
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
s
,
t
;
typename
graph_traits
<
Graph
>::
vertex_descriptor
s
rc
,
tg
t
;
s
=
source
(
*
e
,
g
);
t
=
target
(
*
e
,
g
);
if
(
s
!=
t
)
s
rc
=
source
(
*
e
,
g
);
t
gt
=
target
(
*
e
,
g
);
if
(
s
rc
!=
tg
t
)
{
size_t
k1
=
out_degree_no_loops
(
s
,
g
);
size_t
k2
=
out_degree_no_loops
(
t
,
g
);
size_t
k1
=
out_degree_no_loops
(
s
rc
,
g
);
size_t
k2
=
out_degree_no_loops
(
t
gt
,
g
);
_Pkk
[
k1
][
k2
]
++
;
_Pkk
[
k2
][
k1
]
++
;
E
++
;
...
...
src/graph/community/graph_community_network.cc
View file @
70a2ce29
...
...
@@ -50,7 +50,7 @@ struct get_community_network_dispatch
class
VertexWeightMap
,
class
EdgeWeightMap
,
class
EdgeIndex
,
class
VertexIndex
>
void
operator
()(
const
Graph
&
g
,
CommunityGraph
&
cg
,
VertexIndex
cvertex_index
,
EdgeIndex
cedge_index
,
VertexIndex
,
EdgeIndex
cedge_index
,
CommunityMap
s_map
,
boost
::
any
acs_map
,
VertexWeightMap
vweight
,
EdgeWeightMap
eweight
,
pair
<
boost
::
any
,
boost
::
any
>
count
)
const
...
...
@@ -67,7 +67,7 @@ struct get_community_network_dispatch
vweight_t
vertex_count
=
boost
::
any_cast
<
vweight_t
>
(
count
.
first
);
eweight_t
edge_count
=
boost
::
any_cast
<
eweight_t
>
(
count
.
second
);
get_community_network
()(
g
,
cg
,
c
vertex_index
,
c
edge_index
,
s_map
,
get_community_network
()(
g
,
cg
,
cedge_index
,
s_map
,
cs_map
,
vweight
,
eweight
,
vertex_count
,
edge_count
,
_self_loops
);
}
...
...
src/graph/community/graph_community_network.hh
View file @
70a2ce29
...
...
@@ -37,11 +37,9 @@ using namespace boost;
struct
get_community_network
{
template
<
class
Graph
,
class
CommunityGraph
,
class
CommunityMap
,
class
CCommunityMap
,
class
VertexWeightMap
,
class
EdgeWeightMap
,
class
EdgeIndex
,
class
VertexIndex
,
class
VertexProperty
,
class
EdgeProperty
>
void
operator
()(
const
Graph
&
g
,
CommunityGraph
&
cg
,
VertexIndex
cvertex_index
,
EdgeIndex
cedge_index
,
class
CCommunityMap
,
class
VertexWeightMap
,
class
EdgeWeightMap
,
class
EdgeIndex
,
class
VertexProperty
,
class
EdgeProperty
>
void
operator
()(
const
Graph
&
g
,
CommunityGraph
&
cg
,
EdgeIndex
cedge_index
,
CommunityMap
s_map
,
CCommunityMap
cs_map
,
VertexWeightMap
vweight
,
EdgeWeightMap
eweight
,
VertexProperty
vertex_count
,
EdgeProperty
edge_count
,
...
...
@@ -60,12 +58,12 @@ struct get_community_network
tr1
::
unordered_map
<
s_type
,
pair
<
vector
<
vertex_t
>
,
vprop_type
>
,
hash
<
s_type
>
>
comms
;
typename
graph_traits
<
Graph
>::
vertex_iterator
v
,
v
_end
;
for
(
tie
(
v
,
v_end
)
=
vertices
(
g
);
v
!=
v_end
;
++
v
)
typename
graph_traits
<
Graph
>::
vertex_iterator
v
i
,
vi
_end
;
for
(
tie
(
v
i
,
vi_end
)
=
vertices
(
g
);
vi
!=
vi_end
;
++
vi
)
{
pair
<
vector
<
vertex_t
>
,
vprop_type
>&
m
=
comms
[
get
(
s_map
,
*
v
)];
m
.
first
.
push_back
(
*
v
);
m
.
second
+=
get
(
vweight
,
*
v
);
pair
<
vector
<
vertex_t
>
,
vprop_type
>&
m
=
comms
[
get
(
s_map
,
*
v
i
)];
m
.
first
.
push_back
(
*
v
i
);
m
.
second
+=
get
(
vweight
,
*
v
i
);
}
// create vertices
...
...
@@ -123,16 +121,16 @@ struct get_community_network
void
put_dispatch
(
PropertyMap
cs_map
,
const
typename
property_traits
<
PropertyMap
>::
key_type
&
v
,
const
typename
property_traits
<
PropertyMap
>::
value_type
&
val
,
mpl
::
true_
is_writable
)
const
mpl
::
true_
/*is_writable*/
)
const
{
put
(
cs_map
,
v
,
val
);
}
template
<
class
PropertyMap
>
void
put_dispatch
(
PropertyMap
cs_map
,
const
typename
property_traits
<
PropertyMap
>::
key_type
&
v
,
const
typename
property_traits
<
PropertyMap
>::
value_type
&
val
,
mpl
::
false_
is_writable
)
const
void
put_dispatch
(
PropertyMap
,
const
typename
property_traits
<
PropertyMap
>::
key_type
&
,
const
typename
property_traits
<
PropertyMap
>::
value_type
&
,
mpl
::
false_
/*is_writable*/
)
const
{
}
...
...
src/graph/correlations/graph_assortativity.hh
View file @
70a2ce29
...
...
@@ -58,11 +58,11 @@ struct get_assortativity_coefficient
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
())
continue
;
double
k1
=
d
eg
(
v
,
g
);
double
k1
=
d
ouble
(
deg
(
v
,
g
)
);
typename
graph_traits
<
Graph
>::
out_edge_iterator
e
,
e_end
;
for
(
tie
(
e
,
e_end
)
=
out_edges
(
v
,
g
);
e
!=
e_end
;
++
e
)
{
double
k2
=
d
eg
(
target
(
*
e
,
g
),
g
);
double
k2
=
d
ouble
(
deg
(
target
(
*
e
,
g
),
g
)
);
if
(
k1
==
k2
)
e_kk
+=
c
;
sa
[
k1
]
+=
c
;
...
...
@@ -93,11 +93,11 @@ struct get_assortativity_coefficient
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
())
continue
;
double
k1
=
d
eg
(
v
,
g
);
double
k1
=
d
ouble
(
deg
(
v
,
g
)
);
typename
graph_traits
<
Graph
>::
out_edge_iterator
e
,
e_end
;
for
(
tie
(
e
,
e_end
)
=
out_edges
(
v
,
g
);
e
!=
e_end
;
++
e
)
{
double
k2
=
d
eg
(
target
(
*
e
,
g
),
g
);
double
k2
=
d
ouble
(
deg
(
target
(
*
e
,
g
),
g
)
);
double
tl2
=
(
t2
*
(
n_edges
*
n_edges
)
-
b
[
k1
]
-
a
[
k2
])
/
((
n_edges
-
1
)
*
(
n_edges
-
1
));
double
tl1
=
t1
*
n_edges
;
...
...
@@ -137,11 +137,11 @@ struct get_scalar_assortativity_coefficient
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
())
continue
;
double
k1
=
d
eg
(
v
,
g
);
double
k1
=
d
ouble
(
deg
(
v
,
g
)
);
typename
graph_traits
<
Graph
>::
out_edge_iterator
e
,
e_end
;
for
(
tie
(
e
,
e_end
)
=
out_edges
(
v
,
g
);
e
!=
e_end
;
++
e
)
{
double
k2
=
d
eg
(
target
(
*
e
,
g
),
g
);
double
k2
=
d
ouble
(
deg
(
target
(
*
e
,
g
),
g
)
);
a
+=
k1
*
c
;
da
+=
k1
*
k1
*
c
;
b
+=
k2
*
c
;
...
...
@@ -174,14 +174,14 @@ struct get_scalar_assortativity_coefficient
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
())
continue
;
double
k1
=
d
eg
(
v
,
g
);
double
k1
=
d
ouble
(
deg
(
v
,
g
)
);
double
al
=
(
a
*
n_edges
-
k1
)
/
(
n_edges
-
1
);
double
dal
=
sqrt
((
da
-
k1
*
k1
)
/
(
n_edges
-
1
)
-
al
*
al
);
typename
graph_traits
<
Graph
>::
out_edge_iterator
e
,
e_end
;
for
(
tie
(
e
,
e_end
)
=
out_edges
(
v
,
g
);
e
!=
e_end
;
++
e
)
{
double
k2
=
d
eg
(
target
(
*
e
,
g
),
g
);
double
k2
=
d
ouble
(
deg
(
target
(
*
e
,
g
),
g
)
);
double
bl
=
(
b
*
n_edges
-
k2
)
/
(
n_edges
-
1
);
double
dbl
=
sqrt
((
db
-
k2
*
k2
)
/
(
n_edges
-
1
)
-
bl
*
bl
);
double
t1l
=
(
e_xy
-
k1
*
k2
)
/
(
n_edges
-
1
);
...
...
src/graph/correlations/graph_avg_correlations.hh
View file @
70a2ce29
...
...
@@ -79,7 +79,7 @@ struct get_avg_correlation
s_sum2
.
Gather
();
s_count
.
Gather
();
for
(
size_t
i
=
0
;
i
<
sum
.
GetArray
().
size
(
);
++
i
)
for
(
i
=
0
;
i
<
int
(
sum
.
GetArray
().
size
()
);
++
i
)
{
sum
.
GetArray
()[
i
]
/=
count
.
GetArray
()[
i
];