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
0f5d1a99
Commit
0f5d1a99
authored
Sep 09, 2014
by
Tiago Peixoto
Browse files
Small performance improvement to sfdp_layout()
parent
ab6bef60
Changes
1
Show whitespace changes
Inline
Side-by-side
src/graph/layout/graph_sfdp.hh
View file @
0f5d1a99
...
...
@@ -45,6 +45,8 @@ public:
:
_ll
(
ll
),
_ur
(
ur
),
_cm
(
2
,
0
),
_count
(
0
),
_max_level
(
max_level
)
{
_w
=
sqrt
(
power
(
_ur
[
0
]
-
_ll
[
0
],
2
)
+
power
(
_ur
[
1
]
-
_ll
[
1
],
2
));
}
QuadTree
&
get_leaf
(
size_t
i
)
...
...
@@ -104,10 +106,9 @@ public:
cm
[
i
]
=
_cm
[
i
]
/
_count
;
}
double
get_w
()
double
get_w
()
const
{
return
sqrt
(
power
(
_ur
[
0
]
-
_ll
[
0
],
2
)
+
power
(
_ur
[
1
]
-
_ll
[
1
],
2
));
return
_w
;
}
Weight
get_count
()
...
...
@@ -127,6 +128,7 @@ private:
Pos
_cm
;
Weight
_count
;
int
_max_level
;
double
_w
;
};
template
<
class
Pos
>
...
...
@@ -284,7 +286,8 @@ struct get_sfdp_layout
size_t
nmoves
=
0
;
N
=
vertices
.
size
();
#pragma omp parallel for default(shared) private(i) \
vector
<
std
::
reference_wrapper
<
QuadTree
<
pos_t
,
vweight_t
>>>
Q
;
#pragma omp parallel for default(shared) private(i, Q) \
reduction(+:E, delta, nmoves) schedule(runtime) if (N > 100)
for
(
i
=
0
;
i
<
N
;
++
i
)
{
...
...
@@ -293,7 +296,6 @@ struct get_sfdp_layout
pos_t
diff
(
2
,
0
),
pos_u
(
2
,
0
),
ftot
(
2
,
0
),
cm
(
2
,
0
);
// global repulsive forces
vector
<
std
::
reference_wrapper
<
QuadTree
<
pos_t
,
vweight_t
>
>
>
Q
;
Q
.
push_back
(
std
::
ref
(
qt
));
while
(
!
Q
.
empty
())
{
...
...
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