Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
adt2amas
Manage
Activity
Members
Labels
Plan
Issues
9
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
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
PARTIES
tools
adt2amas
Commits
ba26b919
Commit
ba26b919
authored
6 years ago
by
Giann Karlo Aguirre Samboní
Browse files
Options
Downloads
Patches
Plain Diff
first presentation adtrees
parent
97feb47b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/ad_tree.cpp
+1
-0
1 addition, 0 deletions
src/ad_tree.cpp
src/adt2amas.cpp
+44
-20
44 additions, 20 deletions
src/adt2amas.cpp
with
45 additions
and
20 deletions
src/ad_tree.cpp
+
1
−
0
View file @
ba26b919
...
...
@@ -164,6 +164,7 @@ int ADtree::empty_tree(TreeNode *node){
// Printing tree...
/* Implementin this !!! */
string
ADtree
::
get_info_inorder
(
TreeNode
*
node
,
string
info
){
//node = (node == nullptr && info == "") ? this->root_ : node;
/* TreeNode* tmp_node = new TreeNode();
...
...
This diff is collapsed.
Click to expand it.
src/adt2amas.cpp
+
44
−
20
View file @
ba26b919
...
...
@@ -19,36 +19,49 @@ int main(){
// Adding...
tree
->
add_child
(
node_two
,
node_one
);
tree
->
add_child
(
node_three
,
node_one
);
/*
tree->add_child(node_three, node_one);
tree->add_child(node_four, node_one);
tree
->
add_child
(
node_five
,
node_one
);
tree->add_child(node_five, node_one);
*/
tree
->
add_child
(
node_six
,
node_one
);
tree
->
add_parent
(
node_two
,
node_six
);
tree
->
add_child
(
node_seven
,
node_six
);
/*
tree->add_child(node_seven, node_six);
tree->add_child_pos(node_eight, node_one, 5);
tree->add_parent(node_three, node_six);
tree->add_parent_pos(node_nine, node_six, 3);
tree->add_child(node_six, node_six); // probably doesn't make sense
tree
->
add_parent
(
node_one
,
node_one
);
// probably doesn't make sense
tree->add_parent(node_one, node_one); // probably doesn't make sense
*/
//cout << *(node_one->get_associated_ids().begin()) << endl;
cout
<<
"first parent of node six: "
<<
node_six
->
get_first_parent
()
->
get_id
()
<<
endl
;
/*
cout << "first parent of node six: " << node_six->get_first_parent()->get_id() << endl;
cout << "second parent of node six: " << node_six->get_first_parent()->get_next_pibling()->get_id() << endl;
cout << "third parent of node six: " << node_six->get_first_parent()->get_next_pibling()->get_next_pibling()->get_id() << endl;
cout << "first parent of node eight: " << node_eight->get_first_parent()->get_id() << endl;
cout << "last child of node one: " << node_one->get_first_child()->get_next_sibling()->get_next_sibling()->get_next_sibling()->get_next_sibling()->get_next_sibling()->get_id() << endl;
cout
<<
"fourth parent of node six: "
<<
node_six
->
get_first_parent
()
->
get_next_pibling
()
->
get_next_pibling
()
->
get_next_pibling
()
->
get_id
()
<<
endl
;
cout << "fourth parent of node six: " << node_six->get_first_parent()->get_next_pibling()->get_next_pibling()->get_next_pibling()->get_id() << endl; */
cout
<<
node_one
->
get_info
()
<<
endl
;
cout
<<
node_two
->
get_info
()
<<
endl
;
cout
<<
node_three
->
get_info
()
<<
endl
;
cout
<<
node_four
->
get_info
()
<<
endl
;
cout
<<
node_five
->
get_info
()
<<
endl
;
cout
<<
node_six
->
get_info
()
<<
endl
;
cout
<<
node_seven
->
get_info
()
<<
endl
;
cout
<<
node_eight
->
get_info
()
<<
endl
;
cout
<<
node_nine
->
get_info
()
<<
endl
;
cout
<<
node_ten
->
get_info
()
<<
endl
;
// Removing...
tree
->
remove_child
(
node_six
,
node_one
);
tree
->
remove_parent_pos
(
0
,
node_six
);
/*
tree->remove_child(node_six, node_one);
tree->remove_parent_pos(0, node_six);
*/
//tree->remove_child_pos(0, node_ten);
// Lineage printing...
cout
<<
"child associated ids of node one:"
<<
endl
;
/*
cout << "child associated ids of node one:" << endl;
for (auto& i : node_one->get_child_associated_ids()) // reference to The C++ Programming Language book, p. 899
cout << i << ' ';
cout
<<
endl
<<
"parent associated ids of node one:"
<<
endl
;
std::cout << endl; */
/* cout << endl << "parent associated ids of node one:" << endl;
for (auto& i : node_one->get_parent_associated_ids()) // reference to The C++ Programming Language book, p. 899
cout << i << ' ';
cout << endl << "parent associated ids of node four:" << endl;
...
...
@@ -59,28 +72,39 @@ int main(){
cout << i << ' ';
cout << endl << "parent associated ids of node six:" << endl;
for (auto& i : node_six->get_parent_associated_ids()) // reference to The C++ Programming Language book, p. 899
cout
<<
i
<<
' '
;
cout << i << ' ';
*/
/*
set<int> tmp_set = node_one->get_child_associated_ids();
for(auto it = (tmp_set).cbegin() ; it != (tmp_set).cend() && *it != cur_child->get_id(); it++){
std::cout << *it << ' ';
} */
std
::
cout
<<
endl
;
cout
<<
node_six
->
get_parents
()
<<
endl
;
cout
<<
node_six
->
get_children
()
<<
endl
;
/* cout << node_six->get_parents() << endl;
cout << node_six->get_children() << endl; */
cout
<<
"Removing ..."
<<
endl
;
//cout << node_six->get_info() << endl;
cout
<<
tree
->
get_info_inorder
()
<<
endl
;
/*
cout << tree->get_info_inorder() << endl;
*/
/*tree->preorder_print();
tree->inorder_print();
tree->postorder_print();
tree->postorder_print();*/
cout
<<
node_one
->
get_info
()
<<
endl
;
cout
<<
node_two
->
get_info
()
<<
endl
;
cout
<<
node_three
->
get_info
()
<<
endl
;
cout
<<
node_four
->
get_info
()
<<
endl
;
cout
<<
node_five
->
get_info
()
<<
endl
;
cout
<<
node_six
->
get_info
()
<<
endl
;
cout
<<
node_seven
->
get_info
()
<<
endl
;
cout
<<
node_eight
->
get_info
()
<<
endl
;
cout
<<
node_nine
->
get_info
()
<<
endl
;
cout
<<
node_ten
->
get_info
()
<<
endl
;
tree->get_root()->set_goal("Hola Giann Karlo");*/
delete
tree
;
NodeType
nodeTest
{
NodeType
::
Attack
};
cout
<<
"node type = "
<<
to_string
(
nodeTest
)
<<
endl
;
/* NodeType nodeTest{NodeType::Attack};
cout << "node type = " << to_string(nodeTest) << endl; */
return
0
;
}
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