Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Algorithms Library Toolkit Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Container Registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Algorithms Library Toolkit
Algorithms Library Toolkit Core
Commits
e8d1b92d
"README.md" did not exist on "f87d9ef62b3295ddf6a861209f225691db4ca67d"
Commit
e8d1b92d
authored
9 years ago
by
Jan Trávníček
Browse files
Options
Downloads
Patches
Plain Diff
naive subtree repeats for prefix ranked bar trees
parent
7249b9dc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
alib2algo/src/arbology/exact/ExactSubtreeRepeatsNaive.cpp
+38
-3
38 additions, 3 deletions
alib2algo/src/arbology/exact/ExactSubtreeRepeatsNaive.cpp
alib2algo/src/arbology/exact/ExactSubtreeRepeatsNaive.h
+3
-1
3 additions, 1 deletion
alib2algo/src/arbology/exact/ExactSubtreeRepeatsNaive.h
with
41 additions
and
4 deletions
alib2algo/src/arbology/exact/ExactSubtreeRepeatsNaive.cpp
+
38
−
3
View file @
e8d1b92d
...
...
@@ -11,6 +11,7 @@
#include
<exception/AlibException.h>
#include
<tree/ranked/RankedTree.h>
#include
<tree/ranked/PrefixRankedTree.h>
#include
<tree/ranked/PrefixRankedBarTree.h>
#include
<tree/Tree.h>
#include
<global/GlobalData.h>
...
...
@@ -51,7 +52,7 @@ tree::RankedTree ExactSubtreeRepeatsNaive::repeats ( const tree::RankedTree & tr
auto
ExactRepeatsNaiveRankedTree
=
ExactSubtreeRepeatsNaive
::
RegistratorWrapper
<
tree
::
RankedTree
,
tree
::
RankedTree
>
(
ExactSubtreeRepeatsNaive
::
getInstance
(
),
ExactSubtreeRepeatsNaive
::
repeats
);
alphabet
::
RankedSymbol
ExactSubtreeRepeatsNaive
::
repeats
(
const
std
::
vector
<
alphabet
::
RankedSymbol
>
&
symbols
,
std
::
vector
<
alphabet
::
RankedSymbol
>
&
res
,
std
::
map
<
std
::
pair
<
alphabet
::
RankedSymbol
,
std
::
vector
<
alphabet
::
RankedSymbol
>
>
,
int
>
&
data
,
int
&
minId
,
int
&
index
)
{
alphabet
::
RankedSymbol
ExactSubtreeRepeatsNaive
::
repeats
PrefixRanked
(
const
std
::
vector
<
alphabet
::
RankedSymbol
>
&
symbols
,
std
::
vector
<
alphabet
::
RankedSymbol
>
&
res
,
std
::
map
<
std
::
pair
<
alphabet
::
RankedSymbol
,
std
::
vector
<
alphabet
::
RankedSymbol
>
>
,
int
>
&
data
,
int
&
minId
,
int
&
index
)
{
int
begin
=
index
;
std
::
pair
<
alphabet
::
RankedSymbol
,
std
::
vector
<
alphabet
::
RankedSymbol
>
>
childRepeatsKey
(
symbols
[
begin
],
std
::
vector
<
alphabet
::
RankedSymbol
>
(
)
);
...
...
@@ -60,7 +61,7 @@ alphabet::RankedSymbol ExactSubtreeRepeatsNaive::repeats ( const std::vector < a
index
++
;
for
(
unsigned
i
=
0
;
i
<
symbols
[
begin
].
getRank
(
).
getData
(
);
++
i
)
childRepeatsKey
.
second
.
push_back
(
repeats
(
symbols
,
res
,
data
,
minId
,
index
)
);
childRepeatsKey
.
second
.
push_back
(
repeats
PrefixRanked
(
symbols
,
res
,
data
,
minId
,
index
)
);
int
&
uniqueRepeatId
=
data
[
childRepeatsKey
];
...
...
@@ -76,12 +77,46 @@ tree::PrefixRankedTree ExactSubtreeRepeatsNaive::repeats ( const tree::PrefixRan
std
::
vector
<
alphabet
::
RankedSymbol
>
res
;
std
::
map
<
std
::
pair
<
alphabet
::
RankedSymbol
,
std
::
vector
<
alphabet
::
RankedSymbol
>
>
,
int
>
data
;
repeats
(
tree
.
getContent
(
),
res
,
data
,
minId
,
index
);
repeats
PrefixRanked
(
tree
.
getContent
(
),
res
,
data
,
minId
,
index
);
return
tree
::
PrefixRankedTree
(
res
);
}
auto
ExactRepeatsNaivePrefixRankedTree
=
ExactSubtreeRepeatsNaive
::
RegistratorWrapper
<
tree
::
PrefixRankedTree
,
tree
::
PrefixRankedTree
>
(
ExactSubtreeRepeatsNaive
::
getInstance
(
),
ExactSubtreeRepeatsNaive
::
repeats
);
alphabet
::
RankedSymbol
ExactSubtreeRepeatsNaive
::
repeatsPrefixRankedBar
(
const
std
::
vector
<
alphabet
::
RankedSymbol
>
&
symbols
,
std
::
vector
<
alphabet
::
RankedSymbol
>
&
res
,
std
::
map
<
std
::
pair
<
alphabet
::
RankedSymbol
,
std
::
vector
<
alphabet
::
RankedSymbol
>
>
,
int
>
&
data
,
int
&
minId
,
int
&
index
)
{
int
begin
=
index
;
std
::
pair
<
alphabet
::
RankedSymbol
,
std
::
vector
<
alphabet
::
RankedSymbol
>
>
childRepeatsKey
(
symbols
[
begin
],
std
::
vector
<
alphabet
::
RankedSymbol
>
(
)
);
res
.
push_back
(
alphabet
::
RankedSymbol
(
alphabet
::
symbolFrom
(
0
),
symbols
[
begin
].
getRank
(
)
)
);
index
++
;
for
(
unsigned
i
=
0
;
i
<
symbols
[
begin
].
getRank
(
).
getData
(
);
++
i
)
childRepeatsKey
.
second
.
push_back
(
repeatsPrefixRankedBar
(
symbols
,
res
,
data
,
minId
,
index
)
);
int
&
uniqueRepeatId
=
data
[
childRepeatsKey
];
if
(
uniqueRepeatId
==
0
)
uniqueRepeatId
=
minId
++
;
res
[
begin
]
=
alphabet
::
RankedSymbol
(
alphabet
::
symbolFrom
(
uniqueRepeatId
),
symbols
[
begin
].
getRank
(
)
);
res
.
push_back
(
symbols
[
index
]
);
index
++
;
return
res
[
begin
];
}
tree
::
PrefixRankedBarTree
ExactSubtreeRepeatsNaive
::
repeats
(
const
tree
::
PrefixRankedBarTree
&
tree
)
{
int
minId
=
1
;
int
index
=
0
;
std
::
vector
<
alphabet
::
RankedSymbol
>
res
;
std
::
map
<
std
::
pair
<
alphabet
::
RankedSymbol
,
std
::
vector
<
alphabet
::
RankedSymbol
>
>
,
int
>
data
;
repeatsPrefixRankedBar
(
tree
.
getContent
(
),
res
,
data
,
minId
,
index
);
return
tree
::
PrefixRankedBarTree
(
tree
.
getBarSymbol
(
),
res
);
}
auto
ExactRepeatsNaivePrefixRankedBarTree
=
ExactSubtreeRepeatsNaive
::
RegistratorWrapper
<
tree
::
PrefixRankedBarTree
,
tree
::
PrefixRankedBarTree
>
(
ExactSubtreeRepeatsNaive
::
getInstance
(
),
ExactSubtreeRepeatsNaive
::
repeats
);
}
/* namespace exact */
}
/* namespace arbology */
This diff is collapsed.
Click to expand it.
alib2algo/src/arbology/exact/ExactSubtreeRepeatsNaive.h
+
3
−
1
View file @
e8d1b92d
...
...
@@ -24,7 +24,8 @@ namespace exact {
*/
class ExactSubtreeRepeatsNaive : public std::SingleDispatch < tree::Tree, tree::TreeBase > {
static tree::RankedNode * repeats ( const tree::RankedNode & node, std::map < std::pair < alphabet::RankedSymbol, std::vector < alphabet::RankedSymbol > >, int > & data, int & minId );
static alphabet::RankedSymbol repeats ( const std::vector < alphabet::RankedSymbol > & symbols, std::vector < alphabet::RankedSymbol > & res, std::map < std::pair < alphabet::RankedSymbol, std::vector < alphabet::RankedSymbol > >, int > & data, int & minId, int & index );
static alphabet::RankedSymbol repeatsPrefixRanked ( const std::vector < alphabet::RankedSymbol > & symbols, std::vector < alphabet::RankedSymbol > & res, std::map < std::pair < alphabet::RankedSymbol, std::vector < alphabet::RankedSymbol > >, int > & data, int & minId, int & index );
static alphabet::RankedSymbol repeatsPrefixRankedBar ( const std::vector < alphabet::RankedSymbol > & symbols, std::vector < alphabet::RankedSymbol > & res, std::map < std::pair < alphabet::RankedSymbol, std::vector < alphabet::RankedSymbol > >, int > & data, int & minId, int & index );
public:
/**
...
...
@@ -39,6 +40,7 @@ public:
*/
static tree::RankedTree repeats ( const tree::RankedTree & tree );
static tree::PrefixRankedTree repeats ( const tree::PrefixRankedTree & tree );
static tree::PrefixRankedBarTree repeats ( const tree::PrefixRankedBarTree & tree );
static ExactSubtreeRepeatsNaive & getInstance ( ) {
static ExactSubtreeRepeatsNaive res;
...
...
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