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
aad493dd
Commit
aad493dd
authored
Jul 26, 2014
by
Tiago Peixoto
Browse files
Force inline in some key wrapper functions
parent
96f0f7c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/graph/graph_adjacency.hh
View file @
aad493dd
...
...
@@ -444,8 +444,9 @@ struct graph_property_type<adj_list<Vertex> >
//========================================================================
template
<
class
Vertex
>
inline
std
::
pair
<
typename
adj_list
<
Vertex
>::
vertex_iterator
,
typename
adj_list
<
Vertex
>::
vertex_iterator
>
inline
__attribute__
((
always_inline
))
std
::
pair
<
typename
adj_list
<
Vertex
>::
vertex_iterator
,
typename
adj_list
<
Vertex
>::
vertex_iterator
>
vertices
(
const
adj_list
<
Vertex
>&
g
)
{
typedef
typename
adj_list
<
Vertex
>::
vertex_iterator
vi_t
;
...
...
@@ -454,8 +455,9 @@ vertices(const adj_list<Vertex>& g)
template
<
class
Vertex
>
inline
std
::
pair
<
typename
adj_list
<
Vertex
>::
edge_iterator
,
typename
adj_list
<
Vertex
>::
edge_iterator
>
inline
__attribute__
((
always_inline
))
std
::
pair
<
typename
adj_list
<
Vertex
>::
edge_iterator
,
typename
adj_list
<
Vertex
>::
edge_iterator
>
edges
(
const
adj_list
<
Vertex
>&
g
)
{
typedef
typename
adj_list
<
Vertex
>::
edge_list_t
::
const_iterator
ei_t
;
...
...
@@ -477,13 +479,15 @@ edges(const adj_list<Vertex>& g)
}
template
<
class
Vertex
>
inline
Vertex
vertex
(
size_t
i
,
const
adj_list
<
Vertex
>&
)
inline
__attribute__
((
always_inline
))
Vertex
vertex
(
size_t
i
,
const
adj_list
<
Vertex
>&
)
{
return
i
;
}
template
<
class
Vertex
>
inline
std
::
pair
<
typename
adj_list
<
Vertex
>::
edge_descriptor
,
bool
>
inline
__attribute__
((
always_inline
))
std
::
pair
<
typename
adj_list
<
Vertex
>::
edge_descriptor
,
bool
>
edge
(
Vertex
s
,
Vertex
t
,
const
adj_list
<
Vertex
>&
g
)
{
typedef
typename
adj_list
<
Vertex
>::
edge_descriptor
edge_descriptor
;
...
...
@@ -498,26 +502,30 @@ edge(Vertex s, Vertex t, const adj_list<Vertex>& g)
}
template
<
class
Vertex
>
inline
size_t
out_degree
(
Vertex
v
,
const
adj_list
<
Vertex
>&
g
)
inline
__attribute__
((
always_inline
))
size_t
out_degree
(
Vertex
v
,
const
adj_list
<
Vertex
>&
g
)
{
return
g
.
_out_edges
[
v
].
size
();
}
template
<
class
Vertex
>
inline
size_t
in_degree
(
Vertex
v
,
const
adj_list
<
Vertex
>&
g
)
inline
__attribute__
((
always_inline
))
size_t
in_degree
(
Vertex
v
,
const
adj_list
<
Vertex
>&
g
)
{
return
g
.
_in_edges
[
v
].
size
();
}
template
<
class
Vertex
>
inline
size_t
degree
(
Vertex
v
,
const
adj_list
<
Vertex
>&
g
)
inline
__attribute__
((
always_inline
))
size_t
degree
(
Vertex
v
,
const
adj_list
<
Vertex
>&
g
)
{
return
in_degree
(
v
,
g
)
+
out_degree
(
v
,
g
);
}
template
<
class
Vertex
>
inline
std
::
pair
<
typename
adj_list
<
Vertex
>::
out_edge_iterator
,
typename
adj_list
<
Vertex
>::
out_edge_iterator
>
inline
__attribute__
((
always_inline
))
std
::
pair
<
typename
adj_list
<
Vertex
>::
out_edge_iterator
,
typename
adj_list
<
Vertex
>::
out_edge_iterator
>
out_edges
(
Vertex
v
,
const
adj_list
<
Vertex
>&
g
)
{
typedef
typename
adj_list
<
Vertex
>::
out_edge_iterator
ei_t
;
...
...
@@ -527,8 +535,9 @@ out_edges(Vertex v, const adj_list<Vertex>& g)
}
template
<
class
Vertex
>
inline
std
::
pair
<
typename
adj_list
<
Vertex
>::
in_edge_iterator
,
typename
adj_list
<
Vertex
>::
in_edge_iterator
>
inline
__attribute__
((
always_inline
))
std
::
pair
<
typename
adj_list
<
Vertex
>::
in_edge_iterator
,
typename
adj_list
<
Vertex
>::
in_edge_iterator
>
in_edges
(
Vertex
v
,
const
adj_list
<
Vertex
>&
g
)
{
typedef
typename
adj_list
<
Vertex
>::
in_edge_iterator
ei_t
;
...
...
@@ -538,8 +547,9 @@ in_edges(Vertex v, const adj_list<Vertex>& g)
}
template
<
class
Vertex
>
inline
std
::
pair
<
typename
adj_list
<
Vertex
>::
adjacency_iterator
,
typename
adj_list
<
Vertex
>::
adjacency_iterator
>
inline
__attribute__
((
always_inline
))
std
::
pair
<
typename
adj_list
<
Vertex
>::
adjacency_iterator
,
typename
adj_list
<
Vertex
>::
adjacency_iterator
>
adjacent_vertices
(
Vertex
v
,
const
adj_list
<
Vertex
>&
g
)
{
typedef
typename
adj_list
<
Vertex
>::
adjacency_iterator
ai_t
;
...
...
@@ -548,19 +558,22 @@ adjacent_vertices(Vertex v, const adj_list<Vertex>& g)
}
template
<
class
Vertex
>
inline
size_t
num_vertices
(
const
adj_list
<
Vertex
>&
g
)
inline
__attribute__
((
always_inline
))
size_t
num_vertices
(
const
adj_list
<
Vertex
>&
g
)
{
return
g
.
_out_edges
.
size
();
}
template
<
class
Vertex
>
inline
size_t
num_edges
(
const
adj_list
<
Vertex
>&
g
)
inline
__attribute__
((
always_inline
))
size_t
num_edges
(
const
adj_list
<
Vertex
>&
g
)
{
return
g
.
_n_edges
;
}
template
<
class
Vertex
>
inline
Vertex
add_vertex
(
adj_list
<
Vertex
>&
g
)
inline
__attribute__
((
always_inline
))
Vertex
add_vertex
(
adj_list
<
Vertex
>&
g
)
{
size_t
n
=
g
.
_out_edges
.
size
();
g
.
_out_edges
.
resize
(
n
+
1
);
...
...
@@ -852,15 +865,17 @@ inline void remove_edge(const typename adj_list<Vertex>::edge_descriptor& e,
template
<
class
Vertex
>
inline
Vertex
source
(
const
typename
adj_list
<
Vertex
>::
edge_descriptor
&
e
,
const
adj_list
<
Vertex
>&
)
inline
__attribute__
((
always_inline
))
Vertex
source
(
const
typename
adj_list
<
Vertex
>::
edge_descriptor
&
e
,
const
adj_list
<
Vertex
>&
)
{
return
e
.
s
;
}
template
<
class
Vertex
>
inline
Vertex
target
(
const
typename
adj_list
<
Vertex
>::
edge_descriptor
&
e
,
const
adj_list
<
Vertex
>&
)
inline
__attribute__
((
always_inline
))
Vertex
target
(
const
typename
adj_list
<
Vertex
>::
edge_descriptor
&
e
,
const
adj_list
<
Vertex
>&
)
{
return
e
.
t
;
}
...
...
src/graph/graph_selectors.hh
View file @
aad493dd
...
...
@@ -74,6 +74,7 @@ struct in_degreeS
in_degreeS
()
{}
template
<
class
Graph
,
class
Vertex
>
inline
__attribute__
((
always_inline
))
size_t
operator
()(
const
Vertex
&
v
,
const
Graph
&
g
)
const
{
return
in_degreeS
::
operator
()(
v
,
g
,
detail
::
no_weightS
());
...
...
@@ -81,6 +82,7 @@ struct in_degreeS
template
<
class
Graph
,
class
Vertex
,
class
Weight
>
typename
detail
::
get_weight_type
<
Weight
>::
type
inline
__attribute__
((
always_inline
))
operator
()(
const
Vertex
&
v
,
const
Graph
&
g
,
Weight
&&
weight
)
const
{
typedef
typename
is_convertible
...
...
@@ -90,6 +92,7 @@ struct in_degreeS
}
template
<
class
Graph
,
class
Vertex
>
inline
__attribute__
((
always_inline
))
size_t
get_in_degree
(
const
Vertex
&
v
,
const
Graph
&
g
,
std
::
true_type
,
detail
::
no_weightS
)
const
...
...
@@ -111,6 +114,7 @@ struct in_degreeS
}
template
<
class
Graph
,
class
Vertex
,
class
Weight
>
inline
__attribute__
((
always_inline
))
size_t
get_in_degree
(
const
Vertex
&
,
const
Graph
&
,
std
::
false_type
,
Weight
&&
)
const
{
...
...
@@ -125,12 +129,14 @@ struct out_degreeS
out_degreeS
()
{}
template
<
class
Graph
,
class
Vertex
>
inline
__attribute__
((
always_inline
))
size_t
operator
()(
const
Vertex
&
v
,
const
Graph
&
g
)
const
{
return
out_degreeS
::
operator
()(
v
,
g
,
detail
::
no_weightS
());
}
template
<
class
Graph
,
class
Vertex
,
class
Weight
>
inline
__attribute__
((
always_inline
))
typename
detail
::
get_weight_type
<
Weight
>::
type
operator
()(
const
Vertex
&
v
,
const
Graph
&
g
,
Weight
&&
weight
)
const
{
...
...
@@ -150,6 +156,7 @@ struct out_degreeS
}
template
<
class
Graph
,
class
Vertex
>
inline
__attribute__
((
always_inline
))
size_t
get_out_degree
(
const
Vertex
&
v
,
const
Graph
&
g
,
detail
::
no_weightS
)
const
...
...
@@ -164,12 +171,14 @@ struct total_degreeS
total_degreeS
()
{}
template
<
class
Graph
,
class
Vertex
>
inline
__attribute__
((
always_inline
))
size_t
operator
()(
const
Vertex
&
v
,
const
Graph
&
g
)
const
{
return
total_degreeS
::
operator
()(
v
,
g
,
detail
::
no_weightS
());
}
template
<
class
Graph
,
class
Vertex
,
class
Weight
>
inline
__attribute__
((
always_inline
))
typename
detail
::
get_weight_type
<
Weight
>::
type
operator
()(
const
Vertex
&
v
,
const
Graph
&
g
,
Weight
&&
weight
)
const
{
...
...
@@ -180,6 +189,7 @@ struct total_degreeS
}
template
<
class
Graph
,
class
Vertex
,
class
Weight
>
inline
__attribute__
((
always_inline
))
typename
detail
::
get_weight_type
<
Weight
>::
type
get_total_degree
(
const
Vertex
&
v
,
const
Graph
&
g
,
std
::
true_type
,
Weight
&
weight
)
const
...
...
@@ -188,6 +198,7 @@ struct total_degreeS
}
template
<
class
Graph
,
class
Vertex
,
class
Weight
>
inline
__attribute__
((
always_inline
))
typename
detail
::
get_weight_type
<
Weight
>::
type
get_total_degree
(
const
Vertex
&
v
,
const
Graph
&
g
,
std
::
false_type
,
Weight
&
weight
)
...
...
@@ -207,6 +218,7 @@ struct scalarS
scalarS
(
PropertyMap
pmap
)
:
_pmap
(
pmap
)
{}
template
<
class
Descriptor
,
class
Graph
>
inline
__attribute__
((
always_inline
))
typename
boost
::
property_traits
<
PropertyMap
>::
value_type
operator
()(
const
Descriptor
&
d
,
const
Graph
&
)
const
{
...
...
@@ -278,6 +290,7 @@ struct get_in_edges
typedef
typename
boost
::
graph_traits
<
Graph
>::
vertex_descriptor
vertex_descriptor
;
typedef
typename
boost
::
graph_traits
<
Graph
>::
in_edge_iterator
type
;
inline
__attribute__
((
always_inline
))
static
std
::
pair
<
type
,
type
>
get_edges
(
vertex_descriptor
v
,
const
Graph
&
g
)
{
...
...
@@ -295,6 +308,7 @@ struct get_in_edges<Graph,std::false_type>
typedef
typename
boost
::
graph_traits
<
Graph
>::
vertex_descriptor
vertex_descriptor
;
typedef
typename
boost
::
graph_traits
<
Graph
>::
out_edge_iterator
type
;
inline
__attribute__
((
always_inline
))
static
std
::
pair
<
type
,
type
>
get_edges
(
vertex_descriptor
,
const
Graph
&
)
{
...
...
@@ -316,6 +330,7 @@ struct in_edge_iteratorS
typedef
typename
boost
::
graph_traits
<
Graph
>::
vertex_descriptor
vertex_descriptor
;
inline
__attribute__
((
always_inline
))
static
std
::
pair
<
type
,
type
>
get_edges
(
vertex_descriptor
v
,
const
Graph
&
g
)
{
...
...
@@ -331,6 +346,7 @@ struct out_edge_iteratorS
typedef
typename
boost
::
graph_traits
<
Graph
>::
vertex_descriptor
vertex_descriptor
;
inline
__attribute__
((
always_inline
))
static
std
::
pair
<
type
,
type
>
get_edges
(
vertex_descriptor
v
,
const
Graph
&
g
)
{
...
...
@@ -350,6 +366,7 @@ struct get_all_edges
vertex_descriptor
;
typedef
typename
boost
::
graph_traits
<
boost
::
UndirectedAdaptor
<
Graph
>
>::
out_edge_iterator
type
;
inline
__attribute__
((
always_inline
))
static
std
::
pair
<
type
,
type
>
get_edges
(
vertex_descriptor
v
,
const
Graph
&
g
)
{
...
...
@@ -390,6 +407,7 @@ struct all_edges_iteratorS
typedef
typename
boost
::
graph_traits
<
Graph
>::
vertex_descriptor
vertex_descriptor
;
inline
__attribute__
((
always_inline
))
static
std
::
pair
<
type
,
type
>
get_edges
(
vertex_descriptor
v
,
const
Graph
&
g
)
{
...
...
@@ -422,6 +440,7 @@ struct in_or_out_edge_iteratorS
typedef
typename
boost
::
graph_traits
<
Graph
>::
vertex_descriptor
vertex_descriptor
;
inline
__attribute__
((
always_inline
))
static
std
::
pair
<
type
,
type
>
get_edges
(
vertex_descriptor
v
,
const
Graph
&
g
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment