Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
group-connectivity-pub
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Radek Hušek
group-connectivity-pub
Commits
f20caa71
Commit
f20caa71
authored
9 years ago
by
Radek Hušek
Committed by
Radek Hušek
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Implement and enable double subdivision optimization
parent
cf31a83f
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
compileTimeOptions.h
+1
-1
1 addition, 1 deletion
compileTimeOptions.h
group-connectivity.h
+16
-0
16 additions, 0 deletions
group-connectivity.h
groupConnectivity.pyx
+16
-5
16 additions, 5 deletions
groupConnectivity.pyx
with
33 additions
and
6 deletions
compileTimeOptions.h
+
1
−
1
View file @
f20caa71
...
...
@@ -20,6 +20,6 @@ REQUIRES(EXPLICIT_NORMAL_EDGES, USE_NEXT_FORB)
BOOL_OPTION
(
USE_TWO_CUTS
,
1
)
REQUIRES
(
USE_TWO_CUTS
,
USE_NEXT_FORB
&&
EXPLICIT_NORMAL_EDGES
)
BOOL_OPTION
(
USE_DOUBLE_SUBDIVISIONS
,
0
)
BOOL_OPTION
(
USE_DOUBLE_SUBDIVISIONS
,
1
)
REQUIRES
(
USE_DOUBLE_SUBDIVISIONS
,
USE_NEXT_FORB
&&
EXPLICIT_NORMAL_EDGES
)
This diff is collapsed.
Click to expand it.
group-connectivity.h
+
16
−
0
View file @
f20caa71
...
...
@@ -57,6 +57,9 @@ struct Tester : public AbstractTester {
# if USE_TWO_CUTS
std
::
vector
<
TwoCutInt
>
twoCuts
;
# endif
# if USE_DOUBLE_SUBDIVISIONS
std
::
vector
<
EdgeId
>
doubleSubdividedEdges
;
# endif
virtual
void
init
(
int
edges_
,
...
...
@@ -87,6 +90,16 @@ struct Tester : public AbstractTester {
}
}
# if USE_DOUBLE_SUBDIVISIONS
if
(
Ring
::
size
==
4
)
{
for
(
const
auto
&
i
:
dSub
)
{
for
(
auto
e
:
i
)
edgeList
[
e
-
1
]
=
false
;
classEdges
.
push_back
(
i
[
0
]
-
1
);
doubleSubdividedEdges
.
push_back
(
i
[
0
]
-
1
);
}
}
# endif
# if USE_TWO_CUTS
for
(
auto
cut
:
twoCuts_
)
{
if
(
cut
.
first
<
0
)
{
...
...
@@ -227,6 +240,9 @@ struct Tester : public AbstractTester {
# if USE_TWO_CUTS
for
(
const
auto
&
cut
:
twoCuts
)
cut
.
encode
(
forb
,
0
);
# endif
# if USE_DOUBLE_SUBDIVISIONS
for
(
const
auto
&
e
:
doubleSubdividedEdges
)
forb
.
assign
(
e
,
0
);
# endif
do
{
Mapping
copy
(
forb
);
...
...
This diff is collapsed.
Click to expand it.
groupConnectivity.pyx
+
16
−
5
View file @
f20caa71
...
...
@@ -39,7 +39,7 @@ def pathToEdges(G, path):
def
testGroupConnectivity
(
G
,
group
=
"
Z4
"
,
getClasses
=
False
,
useTwoCuts
=
True
,
useDoubleSubdivisions
=
Fals
e
,
useTwoCuts
=
True
,
useDoubleSubdivisions
=
Tru
e
,
debug
=
False
):
cdef
AbstractTester
*
tester
=
NULL
if
group
==
"
Z4
"
:
...
...
@@ -59,19 +59,29 @@ def testGroupConnectivity(G, group = "Z4", getClasses = False,
G
.
set_edge_label
(
u
,
v
,
i
)
i
+=
1
spanningTree
=
Graph
(
G
.
min_spanning_tree
())
spanningTree
=
Graph
(
G
.
min_spanning_tree
(
weight_function
=
lambda
e
:
min
(
G
.
degree
([
e
[
0
],
e
[
1
]]))
))
elemCycles
=
[
[
l
]
+
pathToEdges
(
G
,
spanningTree
.
shortest_path
(
u
,
v
))
for
(
u
,
v
,
l
)
in
set
(
G
.
edge_iterator
())
-
set
(
spanningTree
.
edge_iterator
())
]
spanningTreeEdges
=
[
l
for
(
_
,
_
,
l
)
in
spanningTree
.
edge_iterator
()
]
availableEdges
=
set
(
spanningTreeEdges
)
doubleSubdivisions
=
[]
if
useDoubleSubdivisions
:
for
(
u
,
v
,
l
)
in
G
.
edges
():
if
G
.
degree
([
u
,
v
])
!=
[
2
,
2
]:
continue
edges
=
set
([
l
for
(
_
,
_
,
l
)
in
G
.
edges_incident
([
u
,
v
])
])
if
edges
.
issubset
(
availableEdges
):
doubleSubdivisions
.
append
(
edges
)
availableEdges
-=
edges
twoCuts
=
[]
if
useTwoCuts
:
availableEdges
=
set
(
spanningTreeEdges
)
for
v
in
[
v
for
v
in
G
.
vertices
()
if
G
.
degree
(
v
)
==
2
]:
e
,
f
=
G
.
edges_incident
(
v
)
el
=
e
[
2
]
...
...
@@ -98,8 +108,9 @@ def testGroupConnectivity(G, group = "Z4", getClasses = False,
print
"
Spanning Tree:
"
,
spanningTreeEdges
print
"
Elementary cycles:
"
,
elemCycles
print
"
Two cuts:
"
,
twoCuts
print
"
Double subdivided edges:
"
,
doubleSubdivisions
tester
.
init
(
G
.
num_edges
(),
spanningTreeEdges
,
twoCuts
,
[]
,
elemCycles
)
tester
.
init
(
G
.
num_edges
(),
spanningTreeEdges
,
twoCuts
,
doubleSubdivisions
,
elemCycles
)
ret
=
tester
.
run
()
if
getClasses
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment