Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Tiago Peixoto
graph-tool
Commits
19c9b394
Commit
19c9b394
authored
Oct 15, 2015
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More "auto" and range-based loops
parent
af2fda8f
Pipeline
#51
failed with stage
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
26 deletions
+22
-26
src/graph/centrality/graph_eigentrust.hh
src/graph/centrality/graph_eigentrust.hh
+20
-23
src/graph/centrality/graph_hits.hh
src/graph/centrality/graph_hits.hh
+2
-3
No files found.
src/graph/centrality/graph_eigentrust.hh
View file @
19c9b394
...
...
@@ -52,19 +52,19 @@ struct get_eigentrust
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
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
())
continue
;
c_type
sum
=
0
;
typename
graph_traits
<
Graph
>::
out_edge_iterator
e
,
e_end
;
for
(
tie
(
e
,
e_end
)
=
out_edges
(
v
,
g
);
e
!=
e_end
;
++
e
)
sum
+=
get
(
c
,
*
e
);
for
(
const
auto
&
e
:
out_edges_range
(
v
,
g
))
sum
+=
get
(
c
,
e
);
if
(
sum
>
0
)
for
(
tie
(
e
,
e_end
)
=
out_edges
(
v
,
g
);
e
!=
e_end
;
++
e
)
put
(
c_temp
,
*
e
,
get
(
c
,
*
e
)
/
sum
);
{
for
(
const
auto
&
e
:
out_edges_range
(
v
,
g
))
put
(
c_temp
,
e
,
get
(
c
,
e
)
/
sum
);
}
}
c
=
c_temp
;
}
...
...
@@ -76,15 +76,13 @@ struct get_eigentrust
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
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
())
continue
;
c_sum
[
v
]
=
0
;
typename
graph_traits
<
Graph
>::
out_edge_iterator
e
,
e_end
;
for
(
tie
(
e
,
e_end
)
=
out_edges
(
v
,
g
);
e
!=
e_end
;
++
e
)
c_sum
[
v
]
+=
c
[
*
e
];
for
(
const
auto
&
e
:
out_edges_range
(
v
,
g
))
c_sum
[
v
]
+=
c
[
e
];
}
}
...
...
@@ -109,22 +107,22 @@ struct get_eigentrust
schedule(runtime) if (N > 100) reduction(+:delta)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
())
continue
;
t_temp
[
v
]
=
0
;
typename
in_edge_iteratorS
<
Graph
>::
type
e
,
e_end
;
for
(
tie
(
e
,
e_end
)
=
in_edge_iteratorS
<
Graph
>::
get_edges
(
v
,
g
);
e
!=
e_end
;
++
e
)
for
(
const
auto
&
e
:
in_or_out_edges_range
(
v
,
g
))
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
s
=
source
(
*
e
,
g
);
typename
graph_traits
<
Graph
>::
vertex_descriptor
s
;
if
(
is_directed
::
apply
<
Graph
>::
type
::
value
)
s
=
source
(
e
,
g
);
else
s
=
target
(
e
,
g
);
if
(
!
is_directed
::
apply
<
Graph
>::
type
::
value
)
t_temp
[
v
]
+=
get
(
c
,
*
e
)
*
t
[
s
]
/
abs
(
c_sum
[
s
]);
t_temp
[
v
]
+=
get
(
c
,
e
)
*
t
[
s
]
/
abs
(
c_sum
[
s
]);
else
t_temp
[
v
]
+=
get
(
c
,
*
e
)
*
t
[
s
];
t_temp
[
v
]
+=
get
(
c
,
e
)
*
t
[
s
];
}
delta
+=
abs
(
t_temp
[
v
]
-
t
[
v
]);
}
...
...
@@ -141,8 +139,7 @@ struct get_eigentrust
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
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
())
continue
;
t
[
v
]
=
t_temp
[
v
];
...
...
src/graph/centrality/graph_hits.hh
View file @
19c9b394
...
...
@@ -75,15 +75,14 @@ struct get_hits
schedule(runtime) if (N > 100) reduction(+:x_norm, y_norm)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
typename
graph_traits
<
Graph
>::
vertex_descriptor
v
=
vertex
(
i
,
g
);
auto
v
=
vertex
(
i
,
g
);
if
(
v
==
graph_traits
<
Graph
>::
null_vertex
())
continue
;
x_temp
[
v
]
=
0
;
for
(
const
auto
&
ie
:
in_or_out_edges_range
(
v
,
g
))
{
auto
s
=
source
(
ie
,
g
)
;
typename
graph_traits
<
Graph
>::
vertex_descriptor
s
;
if
(
is_directed
::
apply
<
Graph
>::
type
::
value
)
s
=
source
(
ie
,
g
);
else
...
...
Write
Preview
Markdown
is supported
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