Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
11c15b0b
Commit
11c15b0b
authored
Jul 16, 2015
by
Tiago Peixoto
Browse files
Replace unordered_map/set for gt_hash_map/set whenever possible
parent
a6667db7
Changes
24
Hide whitespace changes
Inline
Side-by-side
src/graph/centrality/graph_closeness.cc
View file @
11c15b0b
...
...
@@ -23,6 +23,7 @@
#include "graph_closeness.hh"
#include <functional>
#include <boost/python.hpp>
using
namespace
std
;
using
namespace
graph_tool
;
...
...
src/graph/centrality/graph_closeness.hh
View file @
11c15b0b
...
...
@@ -26,7 +26,7 @@
#include <boost/python/extract.hpp>
#include "histogram.hh"
#include "
numpy_bind
.hh"
#include "
hash_map_wrap
.hh"
namespace
graph_tool
{
...
...
@@ -182,8 +182,8 @@ struct get_closeness
{
using
namespace
boost
;
typedef
typename
graph_traits
<
Graph
>::
vertex_descriptor
vertex_t
;
typedef
unordered
_map
<
vertex_t
,
default_color_type
,
DescriptorHash
<
VertexIndex
>
>
cmap_t
;
typedef
gt_hash
_map
<
vertex_t
,
default_color_type
,
DescriptorHash
<
VertexIndex
>
>
cmap_t
;
cmap_t
cmap
(
0
,
DescriptorHash
<
VertexIndex
>
(
vertex_index
));
InitializedPropertyMap
<
cmap_t
>
color_map
(
cmap
,
color_traits
<
default_color_type
>::
white
());
...
...
src/graph/clustering/graph_extended_clustering.hh
View file @
11c15b0b
...
...
@@ -20,7 +20,7 @@
#ifndef GRAPH_EXTENDED_CLUSTERING_HH
#define GRAPH_EXTENDED_CLUSTERING_HH
#include
<unordered_set>
#include
"hash_map_wrap.hh"
#include <boost/graph/breadth_first_search.hpp>
...
...
@@ -134,7 +134,7 @@ struct get_extended_clustering
fg_t
fg
(
g
,
keep_all
(),
filter_t
(
v
));
typedef
DescriptorHash
<
IndexMap
>
hasher_t
;
typedef
std
::
unordered
_set
<
vertex_t
,
hasher_t
>
neighbour_set_t
;
typedef
gt_hash
_set
<
vertex_t
,
hasher_t
>
neighbour_set_t
;
neighbour_set_t
neighbours
(
0
,
hasher_t
(
vertex_index
));
neighbour_set_t
targets
(
0
,
hasher_t
(
vertex_index
));
typename
neighbour_set_t
::
iterator
ni
,
ti
;
...
...
@@ -161,14 +161,14 @@ struct get_extended_clustering
// And now we setup and start the BFS bonanza
for
(
ni
=
neighbours
.
begin
();
ni
!=
neighbours
.
end
();
++
ni
)
{
typedef
std
::
unordered
_map
<
vertex_t
,
size_t
,
DescriptorHash
<
IndexMap
>
>
dmap_t
;
typedef
gt_hash
_map
<
vertex_t
,
size_t
,
DescriptorHash
<
IndexMap
>
>
dmap_t
;
dmap_t
dmap
(
0
,
DescriptorHash
<
IndexMap
>
(
vertex_index
));
InitializedPropertyMap
<
dmap_t
>
distance_map
(
dmap
,
numeric_limits
<
size_t
>::
max
());
typedef
std
::
unordered
_map
<
vertex_t
,
default_color_type
,
DescriptorHash
<
IndexMap
>
>
cmap_t
;
typedef
gt_hash
_map
<
vertex_t
,
default_color_type
,
DescriptorHash
<
IndexMap
>
>
cmap_t
;
cmap_t
cmap
(
0
,
DescriptorHash
<
IndexMap
>
(
vertex_index
));
InitializedPropertyMap
<
cmap_t
>
color_map
(
cmap
,
color_traits
<
default_color_type
>::
white
());
...
...
src/graph/clustering/graph_motifs.hh
View file @
11c15b0b
...
...
@@ -19,12 +19,12 @@
#define GRAPH_MOTIFS_HH
#include <boost/graph/isomorphism.hpp>
#include <unordered_set>
#include <boost/functional/hash.hpp>
#include <algorithm>
#include <vector>
#include "random.hh"
#include "hash_map_wrap.hh"
namespace
graph_tool
{
...
...
@@ -313,9 +313,9 @@ struct get_all_motifs
any_cast
<
std
::
vector
<
graph_sg_t
>&>
(
list
);
// this hashes subgraphs according to their signature
std
::
unordered
_map
<
std
::
vector
<
size_t
>
,
std
::
vector
<
pair
<
size_t
,
graph_sg_t
>
>
,
std
::
hash
<
std
::
vector
<
size_t
>>>
sub_list
;
gt_hash
_map
<
std
::
vector
<
size_t
>
,
std
::
vector
<
pair
<
size_t
,
graph_sg_t
>
>
,
std
::
hash
<
std
::
vector
<
size_t
>>>
sub_list
;
std
::
vector
<
size_t
>
sig
;
// current signature
for
(
size_t
i
=
0
;
i
<
subgraph_list
.
size
();
++
i
)
...
...
src/graph/community/graph_blockmodel.cc
View file @
11c15b0b
...
...
@@ -687,7 +687,7 @@ void vector_continuous_map(boost::python::object ovals)
{
multi_array_ref
<
Value
,
1
>
vals
=
get_array
<
Value
,
1
>
(
ovals
);
unordered
_map
<
Value
,
size_t
>
map
;
gt_hash
_map
<
Value
,
size_t
>
map
;
for
(
size_t
i
=
0
;
i
<
vals
.
size
();
++
i
)
{
...
...
src/graph/community/graph_blockmodel.hh
View file @
11c15b0b
...
...
@@ -260,7 +260,7 @@ struct entropy_parallel_edges
auto
get_node
=
[](
size_t
i
)
{
return
i
;};
for
(
auto
v
:
vertices_range
(
g
))
{
unordered
_map
<
decltype
(
v
),
int
>
us
;
gt_hash
_map
<
decltype
(
v
),
int
>
us
;
for
(
auto
e
:
out_edges_range
(
v
,
g
))
{
auto
u
=
target
(
e
,
g
);
...
...
@@ -1911,7 +1911,7 @@ void merge_vertices(size_t u, size_t v, Eprop& eweight_u, Vprop& vweight, Graph&
typedef
typename
graph_traits
<
Graph
>::
vertex_descriptor
vertex_t
;
typedef
typename
graph_traits
<
Graph
>::
edge_descriptor
edge_t
;
unordered
_map
<
vertex_t
,
vector
<
edge_t
>>
ns_u
,
ns_v
;
gt_hash
_map
<
vertex_t
,
vector
<
edge_t
>>
ns_u
,
ns_v
;
for
(
auto
e
:
out_edges_range
(
u
,
g
))
ns_u
[
target
(
e
,
g
)].
push_back
(
e
);
for
(
auto
e
:
out_edges_range
(
v
,
g
))
...
...
@@ -2154,7 +2154,7 @@ double virtual_move(const Vec& vs, size_t s, Vprop& b, VLprop& cv, VVprop& vmap,
if
(
s
==
size_t
(
b
[
vs
[
0
]]))
return
0
;
unordered
_map
<
int
,
vector
<
size_t
>>
us
;
gt_hash
_map
<
int
,
vector
<
size_t
>>
us
;
for
(
size_t
i
=
0
;
i
<
vs
.
size
();
++
i
)
{
size_t
v
=
vs
[
i
];
...
...
@@ -2200,7 +2200,7 @@ double virtual_move(const Vec& vs, size_t s, Vprop& b, VLprop& cv, VVprop& vmap,
if
(
multigraph
&&
!
dense
&&
state
.
overlap_stats
.
is_enabled
())
{
std
::
unordered
_map
<
int
,
size_t
>
bundles
;
gt_hash
_map
<
int
,
size_t
>
bundles
;
auto
&
mi
=
state
.
overlap_stats
.
get_mi
();
for
(
auto
w
:
iter
.
second
)
{
...
...
@@ -2333,7 +2333,7 @@ void move_vertex(const Vec& vs, size_t s, Vprop& b, VLprop& cv, VVprop& vmap,
if
(
s
==
r
)
return
;
unordered
_map
<
int
,
vector
<
size_t
>>
us
;
gt_hash
_map
<
int
,
vector
<
size_t
>>
us
;
for
(
size_t
i
=
0
;
i
<
vs
.
size
();
++
i
)
{
auto
&
ls
=
cv
[
vs
[
i
]];
...
...
@@ -2443,7 +2443,7 @@ void move_sweep(vector<BlockState>& states, vector<MEntries>& m_entries_r,
}
// used only if merging
std
::
unordered
_set
<
vertex_t
>
past_moves
;
gt_hash
_set
<
vertex_t
>
past_moves
;
vector
<
pair
<
vertex_t
,
double
>
>
best_move
;
if
(
nmerges
>
0
||
parallel
)
best_move
.
resize
(
num_vertices
(
g
),
make_pair
(
vertex_t
(
0
),
numeric_limits
<
double
>::
max
()));
...
...
src/graph/community/graph_blockmodel_covariates.hh
View file @
11c15b0b
...
...
@@ -42,7 +42,7 @@ struct ec_hist
void
operator
()(
Graph
&
g
,
const
EVMap
&
ev
,
EMap
&
ec
)
const
{
typedef
typename
property_traits
<
EVMap
>::
value_type
val_t
;
unordered
_map
<
val_t
,
size_t
>
ehist
;
gt_hash
_map
<
val_t
,
size_t
>
ehist
;
for
(
auto
e
:
edges_range
(
g
))
{
auto
iter
=
ehist
.
find
(
ev
[
e
]);
...
...
@@ -76,7 +76,7 @@ struct split_graph
std
::
vector
<
std
::
reference_wrapper
<
VMap
>>&
block_rmap
,
std
::
vector
<
std
::
reference_wrapper
<
VMap
>>&
uvmap
)
const
{
std
::
vector
<
unordered
_map
<
size_t
,
size_t
>>
vhmap
(
num_vertices
(
g
));
std
::
vector
<
gt_hash
_map
<
size_t
,
size_t
>>
vhmap
(
num_vertices
(
g
));
auto
get_v
=
[
&
]
(
size_t
v
,
size_t
l
)
->
size_t
{
...
...
src/graph/community/graph_blockmodel_overlap.cc
View file @
11c15b0b
...
...
@@ -576,7 +576,7 @@ struct get_bv_overlap
{
typedef
typename
graph_traits
<
Graph
>::
vertex_descriptor
vertex_t
;
typedef
unordered
_map
<
int
,
int
>
map_t
;
typedef
gt_hash
_map
<
int
,
int
>
map_t
;
vector
<
map_t
>
hist_in
;
vector
<
map_t
>
hist_out
;
...
...
@@ -730,7 +730,7 @@ struct get_augmented_overlap
void
operator
()(
Graph
&
g
,
VProp
b
,
VIProp
node_index
,
VProp
br_map
,
vector
<
int32_t
>&
br_b
,
vector
<
int32_t
>&
br_ni
)
const
{
unordered
_map
<
std
::
tuple
<
int
,
int
>
,
size_t
>
idx_map
;
gt_hash
_map
<
std
::
tuple
<
int
,
int
>
,
size_t
>
idx_map
;
vector
<
std
::
tuple
<
int
,
int
>>
idx_rmap
;
size_t
pos
=
0
;
...
...
@@ -788,7 +788,7 @@ struct get_overlap_split
template
<
class
Graph
,
class
VVProp
,
class
VProp
>
void
operator
()(
Graph
&
g
,
VVProp
bv
,
VProp
b
)
const
{
unordered
_map
<
vector
<
int
>
,
size_t
>
bvset
;
gt_hash
_map
<
vector
<
int
>
,
size_t
>
bvset
;
for
(
auto
v
:
vertices_range
(
g
))
{
...
...
src/graph/community/graph_blockmodel_overlap.hh
View file @
11c15b0b
...
...
@@ -19,8 +19,6 @@
#define GRAPH_BLOCKMODEL_OVERLAP_HH
#include "config.h"
#include <unordered_set>
#include <unordered_map>
#include <tuple>
#include "graph_blockmodel.hh"
...
...
@@ -96,7 +94,7 @@ public:
{
auto
&
he
=
half_edges
[
i
];
unordered
_map
<
size_t
,
vector
<
size_t
>>
out_us
;
gt_hash
_map
<
size_t
,
vector
<
size_t
>>
out_us
;
for
(
auto
u
:
he
)
{
auto
w
=
_out_neighbours
[
u
];
...
...
@@ -1760,7 +1758,7 @@ void merge_sweep_overlap(vector<BlockState>& states,
Vprop
best_move
=
b
.
copy
();
vector
<
double
>
best_move_dS
;
vector
<
vector
<
vertex_t
>>
groups
(
B
);
vector
<
unordered
_map
<
size_t
,
vector
<
size_t
>>>
bundles
(
B
);
vector
<
gt_hash
_map
<
size_t
,
vector
<
size_t
>>>
bundles
(
B
);
best_move_dS
.
resize
(
B
,
numeric_limits
<
double
>::
max
());
std
::
shuffle
(
vlist
.
begin
(),
vlist
.
end
(),
rng
);
...
...
src/graph/community/graph_community.hh
View file @
11c15b0b
...
...
@@ -18,7 +18,6 @@
#ifndef GRAPH_COMMUNITY_HH
#define GRAPH_COMMUNITY_HH
#include <unordered_set>
#include <tuple>
#include <iostream>
#include <fstream>
...
...
@@ -30,6 +29,7 @@
#include "graph_util.hh"
#include "graph_properties.hh"
#include "random.hh"
#include "hash_map_wrap.hh"
namespace
graph_tool
{
...
...
@@ -37,9 +37,6 @@ namespace graph_tool
using
namespace
std
;
using
namespace
boost
;
using
std
::
unordered_map
;
using
std
::
unordered_set
;
// computes the community structure through a spin glass system with
// simulated annealing
...
...
@@ -74,7 +71,7 @@ struct get_communities
double
Tmin
=
Tinterval
.
first
;
double
Tmax
=
Tinterval
.
second
;
unordered
_map
<
size_t
,
size_t
>
Ns
;
// spin histogram
gt_hash
_map
<
size_t
,
size_t
>
Ns
;
// spin histogram
CommunityMap
temp_s
(
vertex_index
,
num_vertices
(
g
));
// init spins from [0,N-1] and global info
...
...
@@ -120,7 +117,7 @@ struct get_communities
new_s
=
sample_spin
(
rng
);
}
unordered
_map
<
size_t
,
double
>
ns
;
// number of neighbours with a
gt_hash
_map
<
size_t
,
double
>
ns
;
// number of neighbours with a
// given spin 's' (weighted)
// neighborhood spins info
...
...
@@ -221,7 +218,7 @@ struct get_communities
}
// rename spins, starting from zero
unordered
_map
<
size_t
,
size_t
>
spins
;
gt_hash
_map
<
size_t
,
size_t
>
spins
;
for
(
tie
(
vi
,
vi_end
)
=
vertices
(
g
);
vi
!=
vi_end
;
++
vi
)
{
if
(
spins
.
find
(
s
[
*
vi
])
==
spins
.
end
())
...
...
@@ -270,7 +267,7 @@ public:
private:
double
_p
;
unordered
_map
<
size_t
,
size_t
>
_Ns
;
gt_hash
_map
<
size_t
,
size_t
>
_Ns
;
};
template
<
class
Graph
,
class
CommunityMap
>
...
...
@@ -308,7 +305,7 @@ public:
private:
const
Graph
&
_g
;
size_t
_K
;
unordered
_map
<
size_t
,
size_t
>
_Ks
;
gt_hash
_map
<
size_t
,
size_t
>
_Ks
;
};
template
<
class
Graph
,
class
CommunityMap
>
...
...
@@ -317,7 +314,7 @@ class NNKSCorr
public:
NNKSCorr
(
const
Graph
&
g
,
CommunityMap
s
)
:
_g
(
g
)
{
unordered
_set
<
size_t
>
spins
;
gt_hash
_set
<
size_t
>
spins
;
typename
graph_traits
<
Graph
>::
vertex_iterator
v
,
v_end
;
for
(
tie
(
v
,
v_end
)
=
vertices
(
_g
);
v
!=
v_end
;
++
v
)
...
...
@@ -387,9 +384,9 @@ public:
continue
;
if
(
_Pkk
.
find
(
k1
)
->
second
.
find
(
k2
)
==
_Pkk
.
find
(
k1
)
->
second
.
end
())
continue
;
unordered
_map
<
size_t
,
double
>&
NNks_k1
=
_NNks
[
k1
];
gt_hash
_map
<
size_t
,
double
>&
NNks_k1
=
_NNks
[
k1
];
double
Pk1k2
=
_Pkk
[
k1
][
k2
];
unordered
_map
<
size_t
,
size_t
>&
Nksk2
=
_Nks
[
k2
];
gt_hash
_map
<
size_t
,
size_t
>&
Nksk2
=
_Nks
[
k2
];
double
Nk2
=
_Nk
[
k2
];
NNks_k1
[
old_s
]
-=
k1
*
Pk1k2
*
Nksk2
[
old_s
]
/
Nk2
;
if
(
NNks_k1
[
old_s
]
==
0.0
)
...
...
@@ -413,9 +410,9 @@ public:
continue
;
if
(
_Pkk
.
find
(
k1
)
->
second
.
find
(
k2
)
==
_Pkk
.
find
(
k1
)
->
second
.
end
())
continue
;
unordered
_map
<
size_t
,
double
>&
NNks_k1
=
_NNks
[
k1
];
gt_hash
_map
<
size_t
,
double
>&
NNks_k1
=
_NNks
[
k1
];
double
Pk1k2
=
_Pkk
[
k1
][
k2
];
unordered
_map
<
size_t
,
size_t
>&
Nksk2
=
_Nks
[
k2
];
gt_hash
_map
<
size_t
,
size_t
>&
Nksk2
=
_Nks
[
k2
];
double
Nk2
=
_Nk
[
k2
];
NNks_k1
[
old_s
]
+=
k1
*
Pk1k2
*
Nksk2
[
old_s
]
/
Nk2
;
if
(
NNks_k1
[
old_s
]
==
0.0
)
...
...
@@ -427,7 +424,7 @@ public:
double
operator
()(
size_t
k
,
size_t
s
)
const
{
const
unordered
_map
<
size_t
,
double
>&
nnks
=
_NNks
.
find
(
k
)
->
second
;
const
gt_hash
_map
<
size_t
,
double
>&
nnks
=
_NNks
.
find
(
k
)
->
second
;
const
typeof
(
nnks
.
begin
())
iter
=
nnks
.
find
(
s
);
if
(
iter
!=
nnks
.
end
())
return
iter
->
second
;
...
...
@@ -437,10 +434,10 @@ public:
private:
const
Graph
&
_g
;
vector
<
size_t
>
_degs
;
unordered
_map
<
size_t
,
size_t
>
_Nk
;
unordered
_map
<
size_t
,
unordered
_map
<
size_t
,
double
>
>
_Pkk
;
unordered
_map
<
size_t
,
unordered
_map
<
size_t
,
size_t
>
>
_Nks
;
unordered
_map
<
size_t
,
unordered
_map
<
size_t
,
double
>
>
_NNks
;
gt_hash
_map
<
size_t
,
size_t
>
_Nk
;
gt_hash
_map
<
size_t
,
gt_hash
_map
<
size_t
,
double
>
>
_Pkk
;
gt_hash
_map
<
size_t
,
gt_hash
_map
<
size_t
,
size_t
>
>
_Nks
;
gt_hash
_map
<
size_t
,
gt_hash
_map
<
size_t
,
double
>
>
_NNks
;
};
enum
comm_corr_t
...
...
src/graph/correlations/graph_assortativity.hh
View file @
11c15b0b
...
...
@@ -18,10 +18,9 @@
#ifndef GRAPH_ASSORTATIVITY_HH
#define GRAPH_ASSORTATIVITY_HH
#include <unordered_map>
#include "shared_map.hh"
#include "graph_util.hh"
#include "hash_map_wrap.hh"
namespace
graph_tool
{
...
...
@@ -46,7 +45,7 @@ struct get_assortativity_coefficient
count_t
e_kk
=
0
;
typedef
typename
DegreeSelector
::
value_type
val_t
;
typedef
unordered
_map
<
val_t
,
count_t
>
map_t
;
typedef
gt_hash
_map
<
val_t
,
count_t
>
map_t
;
map_t
a
,
b
;
SharedMap
<
map_t
>
sa
(
a
),
sb
(
b
);
...
...
src/graph/generation/graph_generation.hh
View file @
11c15b0b
...
...
@@ -18,7 +18,6 @@
#ifndef GRAPH_GENERATION_HH
#define GRAPH_GENERATION_HH
#include <unordered_map>
#include <tuple>
#include <boost/functional/hash.hpp>
#include <map>
...
...
@@ -27,6 +26,7 @@
#include "graph_util.hh"
#include "random.hh"
#include "hash_map_wrap.hh"
namespace
graph_tool
{
...
...
@@ -465,7 +465,7 @@ struct gen_graph
set
<
deg_t
,
cmp_in
<
greater
<
size_t
>
>
>
targets
;
// vertices with a given degree
unordered
_map
<
deg_t
,
vector
<
size_t
>>
vset
;
gt_hash
_map
<
deg_t
,
vector
<
size_t
>>
vset
;
size_t
num_e
=
0
;
for
(
size_t
i
=
0
;
i
<
vertices
.
size
();
++
i
)
...
...
src/graph/generation/graph_price.hh
View file @
11c15b0b
...
...
@@ -23,7 +23,7 @@
#include "graph_util.hh"
#include "random.hh"
#include
<unordered_set>
#include
"hash_map_wrap.hh"
#include <map>
#include <iostream>
...
...
@@ -61,8 +61,7 @@ struct get_price
if
(
probs
.
empty
()
||
probs
.
rbegin
()
->
first
<=
0
)
throw
GraphException
(
"Cannot connect edges: probabilities are <= 0!"
);
std
::
unordered_set
<
typename
graph_traits
<
Graph
>::
vertex_descriptor
>
visited
;
gt_hash_set
<
typename
graph_traits
<
Graph
>::
vertex_descriptor
>
visited
;
for
(
size_t
i
=
0
;
i
<
N
;
++
i
)
{
visited
.
clear
();
...
...
src/graph/generation/graph_rewiring.hh
View file @
11c15b0b
...
...
@@ -691,7 +691,7 @@ public:
if
(
_probs
.
empty
())
{
std
::
unordered
_set
<
deg_t
>
deg_set
;
gt_hash
_set
<
deg_t
>
deg_set
;
for
(
size_t
ei
=
0
;
ei
<
base_t
::
_edges
.
size
();
++
ei
)
{
edge_t
&
e
=
base_t
::
_edges
[
ei
];
...
...
@@ -829,7 +829,7 @@ public:
if
(
!
is_directed
::
apply
<
Graph
>::
type
::
value
)
_out_pos
.
resize
(
base_t
::
_edges
.
size
());
std
::
unordered
_set
<
deg_t
>
deg_set
;
gt_hash
_set
<
deg_t
>
deg_set
;
for
(
size_t
ei
=
0
;
ei
<
base_t
::
_edges
.
size
();
++
ei
)
{
edge_t
&
e
=
base_t
::
_edges
[
ei
];
...
...
@@ -893,8 +893,8 @@ public:
}
else
{
std
::
unordered
_map
<
deg_t
,
vector
<
double
>>
sprobs
;
std
::
unordered
_map
<
deg_t
,
vector
<
deg_t
>>
sitems
;
gt_hash
_map
<
deg_t
,
vector
<
double
>>
sprobs
;
gt_hash
_map
<
deg_t
,
vector
<
deg_t
>>
sitems
;
for
(
auto
iter
=
_probs
.
begin
();
iter
!=
_probs
.
end
();
++
iter
)
{
deg_t
s
=
iter
->
first
.
first
;
...
...
@@ -1130,7 +1130,7 @@ private:
sampler_map_t
_sampler
;
typedef
gt_hash_map
<
deg_t
,
std
::
unordered
_map
<
deg_t
,
double
>>
sprob_map_t
;
typedef
gt_hash_map
<
deg_t
,
gt_hash
_map
<
deg_t
,
double
>>
sprob_map_t
;
sprob_map_t
_sprob
;
...
...
@@ -1173,7 +1173,7 @@ public:
_vertices
[
d
].
push_back
(
*
v
);
}
std
::
unordered
_map
<
pair
<
deg_t
,
deg_t
>
,
double
>
probs
;
gt_hash
_map
<
pair
<
deg_t
,
deg_t
>
,
double
>
probs
;
_corr_prob
.
get_probs
(
probs
);
vector
<
double
>
dprobs
;
...
...
src/graph/generation/graph_triangulation.hh
View file @
11c15b0b
...
...
@@ -23,12 +23,12 @@
#ifndef GRAPH_TRIANGULATION_HH
#define GRAPH_TRIANGULATION_HH
#include <unordered_set>
#include <tuple>
#include <boost/functional/hash.hpp>
#include "graph_util.hh"
#include "hash_map_wrap.hh"
namespace
graph_tool
{
...
...
@@ -106,7 +106,7 @@ struct get_triangulation
template
<
class
Graph
,
class
Points
,
class
PosMap
>
void
operator
()(
Graph
&
g
,
Points
&
points
,
PosMap
pos
)
const
{
typedef
std
::
unordered
_map
typedef
gt_hash
_map
<
typename
Triang
::
Vertex
,
typename
graph_traits
<
Graph
>::
vertex_descriptor
,
hash_point
>
vertex_map_t
;
...
...
src/graph/graph_properties.cc
View file @
11c15b0b
...
...
@@ -21,8 +21,7 @@
#include "graph_filtering.hh"
#include "graph_selectors.hh"
#include "graph_util.hh"
#include <unordered_set>
#include "hash_map_wrap.hh"
#include <boost/mpl/for_each.hpp>
...
...
@@ -163,7 +162,7 @@ struct do_infect_vertex_property
typedef
typename
property_traits
<
PropertyMap
>::
value_type
val_t
;
bool
all
=
false
;
std
::
unordered_set
<
val_t
,
std
::
hash
<
val_t
>
>
vals
;
gt_hash_set
<
val_t
>
vals
;
if
(
oval
==
boost
::
python
::
object
())
{
all
=
true
;
...
...
@@ -264,7 +263,7 @@ struct do_perfect_vhash
{
typedef
typename
property_traits
<
VertexPropertyMap
>::
value_type
val_t
;
typedef
typename
property_traits
<
HashProp
>::
value_type
hash_t
;
typedef
unordered
_map
<
val_t
,
hash_t
>
dict_t
;
typedef
gt_hash
_map
<
val_t
,
hash_t
>
dict_t
;
if
(
adict
.
empty
())
adict
=
dict_t
();
...
...
@@ -303,7 +302,7 @@ struct do_perfect_ehash
{
typedef
typename
property_traits
<
EdgePropertyMap
>::
value_type
val_t
;
typedef
typename
property_traits
<
HashProp
>::
value_type
hash_t
;
typedef
unordered
_map
<
val_t
,
hash_t
>
dict_t
;
typedef
gt_hash
_map
<
val_t
,
hash_t
>
dict_t
;
if
(
adict
.
empty
())
adict
=
dict_t
();
...
...
src/graph/graph_properties.hh
View file @
11c15b0b
...
...
@@ -21,8 +21,6 @@
#include <typeinfo>
#include <string>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <memory>
#include <random>
#include <functional>
...
...
@@ -46,6 +44,7 @@
#include "graph.hh"
#include "graph_exceptions.hh"
#include "hash_map_wrap.hh"
// this file provides general functions for manipulating graph properties
...
...
@@ -528,7 +527,7 @@ class HashedDescriptorMap
{
public:
typedef
DescriptorHash
<
IndexMap
>
hashfc_t
;
typedef
unordered
_map
<
typename
IndexMap
::
key_type
,
Value
,
hashfc_t
>
typedef
gt_hash
_map
<
typename
IndexMap
::
key_type
,
Value
,
hashfc_t
>
map_t
;
typedef
boost
::
associative_property_map
<
map_t
>
prop_map_t
;
...
...
src/graph/layout/graph_sfdp.cc
View file @
11c15b0b
...
...
@@ -24,6 +24,7 @@
#include "graph_sfdp.hh"
#include "random.hh"
#include "hash_map_wrap.hh"
using
namespace
std
;
using
namespace
boost
;
...
...
@@ -96,7 +97,7 @@ struct do_propagate_pos
typedef
typename
pos_t
::
value_type
val_t
;
uniform_real_distribution
<
val_t
>
noise
(
-
delta
,
delta
);
unordered
_map
<
c_t
,
pos_t
>
cmap
(
num_vertices
(
*
cg
))
;
gt_hash
_map
<
c_t
,
pos_t
>
cmap
;
for
(
auto
v
:
vertices_range
(
*
cg
))
cmap
[
cvmap
[
v
]]
=
cpos
[
v
];
...
...
@@ -133,7 +134,6 @@ void propagate_pos(GraphInterface& gi, GraphInterface& cgi, boost::any vmap,
GraphInterface
::
vertex_index_map_t
>::
type
>::
type
vmaps_t
;
run_action
<>
()
(
gi
,
std
::
bind
(
do_propagate_pos
(),
placeholders
::
_1
,
placeholders
::
_2
,
placeholders
::
_3
,
...
...
src/graph/stats/graph_distance.hh
View file @
11c15b0b
...
...
@@ -27,6 +27,7 @@
#include "histogram.hh"
#include "numpy_bind.hh"
#include "hash_map_wrap.hh"
namespace
graph_tool
{
...
...
@@ -137,8 +138,8 @@ struct get_distance_histogram
DistanceMap
dist_map
,
no_weightS
)
const
{
typedef
typename
graph_traits
<
Graph
>::
vertex_descriptor
vertex_t
;
typedef
unordered
_map
<
vertex_t
,
default_color_type
,
DescriptorHash
<
VertexIndex
>
>
cmap_t
;
typedef
gt_hash
_map
<
vertex_t
,
default_color_type
,
DescriptorHash
<
VertexIndex
>
>
cmap_t
;
cmap_t
cmap
(
0
,
DescriptorHash
<
VertexIndex
>
(
vertex_index
));
InitializedPropertyMap
<
cmap_t
>
color_map
(
cmap
,
color_traits
<
default_color_type
>::
white
());
...
...
src/graph/stats/graph_distance_sampled.hh
View file @
11c15b0b
...
...
@@ -27,6 +27,7 @@
#include "histogram.hh"
#include "numpy_bind.hh"
#include "hash_map_wrap.hh"
namespace
graph_tool
{
...
...
@@ -152,8 +153,8 @@ struct get_sampled_distance_histogram
DistanceMap
dist_map
,
no_weightS
)
const