Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
projet_s6_loic.scoth.etu_mamadulamarana.bah.etu
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
Loic Scoth
projet_s6_loic.scoth.etu_mamadulamarana.bah.etu
Commits
b683b7af
Commit
b683b7af
authored
1 year ago
by
Mamadu-lamarana Bah
Browse files
Options
Downloads
Patches
Plain Diff
suppression cas simple fonctionne
parent
dc8fb3a5
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
README.md
+1
-1
1 addition, 1 deletion
README.md
src/ArbreB/Graph.gv
+0
-12
0 additions, 12 deletions
src/ArbreB/Graph.gv
src/ArbreB/Graph.gv.svg
+0
-52
0 additions, 52 deletions
src/ArbreB/Graph.gv.svg
src/Node.py
+38
-28
38 additions, 28 deletions
src/Node.py
src/Visualization.py
+1
-1
1 addition, 1 deletion
src/Visualization.py
with
40 additions
and
94 deletions
README.md
+
1
−
1
View file @
b683b7af
...
...
@@ -68,4 +68,4 @@ Suite suppression, fonctionne pour le cas d'une feuille.
### emaine 12
Création du Readme, suite suppression.
\ No newline at end of file
Suite suppression.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/ArbreB/Graph.gv
deleted
100644 → 0
+
0
−
12
View file @
dc8fb3a5
graph {
"[12, 42]"
"[2, 3]"
"[12, 42]" -- "[2, 3]"
"[2, 3]"
"[25]"
"[12, 42]" -- "[25]"
"[25]"
"[50]"
"[12, 42]" -- "[50]"
"[50]"
}
This diff is collapsed.
Click to expand it.
src/ArbreB/Graph.gv.svg
deleted
100644 → 0
+
0
−
52
View file @
dc8fb3a5
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.43.0 (0)
-->
<!-- Title: %3 Pages: 1 -->
<svg
width=
"230pt"
height=
"116pt"
viewBox=
"0.00 0.00 230.34 116.00"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
>
<g
id=
"graph0"
class=
"graph"
transform=
"scale(1 1) rotate(0) translate(4 112)"
>
<title>
%3
</title>
<polygon
fill=
"white"
stroke=
"transparent"
points=
"-4,4 -4,-112 226.34,-112 226.34,4 -4,4"
/>
<!-- [12, 42] -->
<g
id=
"node1"
class=
"node"
>
<title>
[12, 42]
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"117.1"
cy=
"-90"
rx=
"46.59"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"117.1"
y=
"-86.3"
font-family=
"Times,serif"
font-size=
"14.00"
>
[12, 42]
</text>
</g>
<!-- [2, 3] -->
<g
id=
"node2"
class=
"node"
>
<title>
[2, 3]
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"35.1"
cy=
"-18"
rx=
"35.19"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"35.1"
y=
"-14.3"
font-family=
"Times,serif"
font-size=
"14.00"
>
[2, 3]
</text>
</g>
<!-- [12, 42]--[2, 3] -->
<g
id=
"edge1"
class=
"edge"
>
<title>
[12, 42]
--
[2, 3]
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M98.49,-73.12C84.69,-61.34 66.01,-45.39 52.51,-33.86"
/>
</g>
<!-- [25] -->
<g
id=
"node3"
class=
"node"
>
<title>
[25]
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"117.1"
cy=
"-18"
rx=
"29.5"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"117.1"
y=
"-14.3"
font-family=
"Times,serif"
font-size=
"14.00"
>
[25]
</text>
</g>
<!-- [12, 42]--[25] -->
<g
id=
"edge2"
class=
"edge"
>
<title>
[12, 42]
--
[25]
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M117.1,-71.7C117.1,-60.85 117.1,-46.92 117.1,-36.1"
/>
</g>
<!-- [50] -->
<g
id=
"node4"
class=
"node"
>
<title>
[50]
</title>
<ellipse
fill=
"none"
stroke=
"black"
cx=
"193.1"
cy=
"-18"
rx=
"29.5"
ry=
"18"
/>
<text
text-anchor=
"middle"
x=
"193.1"
y=
"-14.3"
font-family=
"Times,serif"
font-size=
"14.00"
>
[50]
</text>
</g>
<!-- [12, 42]--[50] -->
<g
id=
"edge3"
class=
"edge"
>
<title>
[12, 42]
--
[50]
</title>
<path
fill=
"none"
stroke=
"black"
d=
"M134.34,-73.12C147.31,-61.18 164.92,-44.95 177.47,-33.39"
/>
</g>
</g>
</svg>
This diff is collapsed.
Click to expand it.
src/Node.py
+
38
−
28
View file @
b683b7af
...
...
@@ -96,12 +96,12 @@ class Node() :
(
Node
([
50
,
52
]),
1
)
>>>
node
=
Node
([
12
,
42
],
[
Node
([
2
,
3
]),
Node
([
25
]),
Node
([
50
])])
>>>
node
.
insert
(
1
,
2
)
(
False
,
12
,
Node
([
2
]
),
Node
([
42
]))
(
False
,
12
,
Node
([
2
]
,
[
Node
([
1
]),
Node
([
3
])]),
Node
([
42
],
[
Node
([
25
]),
Node
([
50
])
]))
>>>
node
.
search
(
1
)
(
Node
([
1
]),
0
)
>>>
node
=
Node
([
12
,
42
],
[
Node
([
2
,
4
],
[
Node
([
0
,
1
]),
Node
([
3
]),
Node
([
7
,
8
])]),
Node
([
25
]),
Node
([
50
])])
>>>
node
.
insert
(
6
,
2
)
(
False
,
12
,
Node
([
4
]
),
Node
([
42
]))
(
False
,
12
,
Node
([
4
]
,
[
Node
([
2
],
[
Node
([
0
,
1
]),
Node
([
3
])]),
Node
([
7
],
[
Node
([
6
]),
Node
([
8
])])]),
Node
([
42
],
[
Node
([
25
]),
Node
([
50
])
]))
>>>
node
=
Node
([
12
,
42
],
[
Node
([
2
,
3
,
4
]),
Node
([
25
]),
Node
([
50
])])
>>>
node
.
insert
(
1
,
3
)
...
...
@@ -137,8 +137,20 @@ class Node() :
Exemple(s):
>>>
node
=
Node
([
12
,
42
],
[
Node
([
3
,
4
]),
Node
([
25
,
26
]),
Node
([
50
,
58
])])
>>>
node
.
suppression
(
50
,
2
)
True
>>>
node
.
search
(
50
)
>>>
node
.
suppression
(
26
,
2
)
True
>>>
node
.
search
(
26
)
>>>
node
.
suppression
(
25
,
2
)
True
>>>
node
.
search
(
25
)
>>>
node
.
suppression
(
12
,
2
)
True
>>>
node
>>>
node
.
suppression
(
3
,
2
)
True
>>>
node
"""
(
found
,
index
)
=
recherche_dichotomique
(
value
,
self
.
keys
)
if
(
self
.
isLeaf
())
:
...
...
@@ -147,33 +159,32 @@ class Node() :
else
:
(
ok
)
=
self
.
childs
[
index
].
suppression
(
value
,
k
,
False
)
if
(
not
ok
):
if
(
index
-
1
>=
0
and
(
len
(
self
.
childs
[
index
-
1
].
keys
)
>=
k
//
2
)):
if
(
index
-
1
>=
0
and
(
len
(
self
.
childs
[
index
-
1
].
keys
)
-
1
>=
k
//
2
)):
borrowed
=
self
.
childs
[
index
-
1
].
keys
.
pop
()
replaced
=
self
.
keys
.
pop
(
0
)
self
.
keys
.
insert
(
0
,
borrowed
)
self
.
childs
[
index
].
keys
.
insert
(
0
,
replaced
)
elif
(
index
+
1
<
len
(
self
.
childs
)
and
(
len
(
self
.
childs
[
index
+
1
].
keys
)
>=
k
//
2
)):
borrowed
=
self
.
childs
[
index
+
1
].
keys
.
pop
(
0
)
elif
(
index
+
1
<
len
(
self
.
childs
)
and
(
len
(
self
.
childs
[
index
+
1
].
keys
)
-
1
>=
k
//
2
)):
borrowed
=
self
.
childs
[
index
+
1
].
keys
.
pop
()
replaced
=
self
.
keys
.
pop
()
self
.
keys
.
insert
(
len
(
self
.
keys
),
borrowed
)
self
.
childs
[
index
].
keys
.
insert
(
len
(
self
.
childs
),
replaced
)
return
ok
# def suppr(self, value, k) :
# """
# >>> a = Node([12, 42], [Node([3]), Node([25]), Node([50])])
# >>> a.suppr(11)
# False
# """
# found = self.search(value)
# if (found) :
# return None
# else :
# return False
self
.
childs
[
index
].
keys
.
insert
(
len
(
self
.
keys
),
borrowed
)
self
.
childs
[
index
].
keys
.
insert
(
len
(
self
.
childs
[
index
].
keys
),
replaced
)
# len(self.childs)
else
:
if
(
index
-
1
>=
0
):
replaced
=
self
.
keys
.
pop
(
index
-
1
)
borrowed
=
self
.
childs
[
index
-
1
].
keys
.
pop
()
self
.
childs
[
index
].
keys
.
insert
(
len
(
self
.
childs
[
index
].
keys
),
replaced
)
self
.
childs
[
index
].
keys
.
insert
(
0
,
borrowed
)
del
self
.
childs
[
index
-
1
]
elif
(
index
+
1
<
len
(
self
.
childs
)):
replaced
=
self
.
keys
.
pop
(
index
)
borrowed
=
self
.
childs
[
index
+
1
].
keys
.
pop
()
self
.
childs
[
index
].
keys
.
insert
(
0
,
borrowed
)
self
.
childs
[
index
].
keys
.
insert
(
len
(
self
.
childs
[
index
].
keys
),
replaced
)
del
self
.
childs
[
index
+
1
]
ok
=
not
ok
return
ok
def
splitNode
(
self
)
:
"""
...
...
@@ -208,8 +219,7 @@ class Node() :
res
.
extend
(
self
.
childs
[
len
(
self
.
childs
)
-
1
].
linearisation
())
return
res
def
__repr__
(
self
)
:
return
(
f
"
Node(
{
self
.
keys
}
"
+
(
f
"
,
{
self
.
childs
}
)
"
if
len
(
self
.
childs
)
>
0
else
"
)
"
))
...
...
This diff is collapsed.
Click to expand it.
src/Visualization.py
+
1
−
1
View file @
b683b7af
...
...
@@ -20,6 +20,6 @@ class Visualization() :
self
.
add_node_to_graph
(
childKeys
)
def
render
(
self
):
self
.
g
.
format
=
'
sv
g
'
self
.
g
.
format
=
'
jp
g
'
self
.
g
.
render
(
directory
=
'
ArbreB
'
,
view
=
True
)
\ No newline at end of file
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