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
4082cdb1
Commit
4082cdb1
authored
Jul 19, 2020
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Graph.copy_property(): fix compatible graph semantics for edge properties
parent
a182344c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
src/graph/graph_properties_copy.hh
src/graph/graph_properties_copy.hh
+12
-12
No files found.
src/graph/graph_properties_copy.hh
View file @
4082cdb1
...
...
@@ -193,29 +193,29 @@ struct copy_external_edge_property_dispatch
void
dispatch
(
const
GraphTgt
&
tgt
,
const
GraphSrc
&
src
,
PropertyTgt
dst_map
,
PropertySrc
src_map
)
const
{
typedef
typename
boost
::
graph_traits
<
Graph
Src
>::
edge_descriptor
edge_t
;
gt_hash_map
<
std
::
tuple
<
size_t
,
size_t
>
,
std
::
deque
<
edge_t
>>
src
_edges
;
for
(
auto
e
:
edges_range
(
src
))
typedef
typename
boost
::
graph_traits
<
Graph
Tgt
>::
edge_descriptor
edge_t
;
gt_hash_map
<
std
::
tuple
<
size_t
,
size_t
>
,
std
::
deque
<
edge_t
>>
tgt
_edges
;
for
(
auto
e
:
edges_range
(
tgt
))
{
auto
u
=
source
(
e
,
src
);
auto
v
=
target
(
e
,
src
);
if
(
!
graph_tool
::
is_directed
(
src
)
&&
u
>
v
)
auto
u
=
source
(
e
,
tgt
);
auto
v
=
target
(
e
,
tgt
);
if
(
!
graph_tool
::
is_directed
(
tgt
)
&&
u
>
v
)
std
::
swap
(
u
,
v
);
src
_edges
[
std
::
make_tuple
(
u
,
v
)].
push_back
(
e
);
tgt
_edges
[
std
::
make_tuple
(
u
,
v
)].
push_back
(
e
);
}
try
{
for
(
auto
e
:
edges_range
(
tgt
))
for
(
auto
e
:
edges_range
(
src
))
{
auto
u
=
source
(
e
,
tgt
);
auto
v
=
target
(
e
,
tgt
);
auto
u
=
source
(
e
,
src
);
auto
v
=
target
(
e
,
src
);
if
(
!
graph_tool
::
is_directed
(
src
)
&&
u
>
v
)
std
::
swap
(
u
,
v
);
auto
&
es
=
src
_edges
[
std
::
make_tuple
(
u
,
v
)];
auto
&
es
=
tgt
_edges
[
std
::
make_tuple
(
u
,
v
)];
if
(
es
.
empty
())
throw
ValueException
(
"source and target graphs are not compatible"
);
put
(
dst_map
,
e
,
get
(
src_map
,
e
s
.
front
()
));
put
(
dst_map
,
e
s
.
front
()
,
get
(
src_map
,
e
));
es
.
pop_front
();
}
}
...
...
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