Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CS-6604-WebArchive
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
xw0078
CS-6604-WebArchive
Commits
19757276
Commit
19757276
authored
5 years ago
by
Ritesh Bansal
Browse files
Options
Downloads
Patches
Plain Diff
added comparison of trees
parent
7794c844
No related branches found
Branches containing commit
No related tags found
1 merge request
!1
Site structure
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Trie.py
+25
-2
25 additions, 2 deletions
Trie.py
main.py
+4
-0
4 additions, 0 deletions
main.py
with
29 additions
and
2 deletions
Trie.py
+
25
−
2
View file @
19757276
...
...
@@ -45,9 +45,32 @@ class Trie:
# extract tree based on given timestamp
return
self
.
root
.
extract
(
startTimestamp
,
endTimeStamp
)
def
comparison
(
self
,
tree1
,
tree2
):
print
()
def
comparison
(
self
,
tree1
):
# compare two trees
from
collections
import
deque
stack_tree2
=
deque
()
stack_tree1
=
deque
()
stack_tree2
.
append
(
self
.
root
)
stack_tree1
.
append
(
tree1
)
while
(
len
(
stack_tree2
)
!=
0
):
tree2
=
stack_tree2
.
pop
()
tree
=
stack_tree1
.
pop
()
for
data
in
tree2
.
data
:
if
tree
.
data
.
__contains__
(
data
):
if
not
tree
.
data
[
data
]
==
tree2
.
data
[
data
]:
return
False
else
:
return
False
for
child
in
tree2
.
children
:
if
tree
.
children
.
__contains__
(
child
):
if
not
stack_tree2
.
__contains__
(
child
):
stack_tree2
.
append
(
tree2
.
children
[
child
])
stack_tree1
.
append
(
tree
.
children
[
child
])
else
:
return
False
return
True
def
main
():
...
...
This diff is collapsed.
Click to expand it.
main.py
+
4
−
0
View file @
19757276
...
...
@@ -47,6 +47,10 @@ for dayData in data_train:
vtTree
=
sitemapURLS
[
'
www.vt.edu
'
]
vtTreeCopy
=
vtTree
.
extract
(
'
20140906125541
'
,
'
20141215204723
'
)
result
=
vtTree
.
comparison
(
vtTreeCopy
)
print
(
result
)
result
=
vtTree
.
comparison
(
vtTree
.
root
)
print
(
result
)
print
(
'
done
'
)
...
...
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