Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlgoTP03
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
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
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TOUMERT Said
AlgoTP03
Commits
f49e231f
Commit
f49e231f
authored
1 year ago
by
Luigi Santocanale
Browse files
Options
Downloads
Patches
Plain Diff
Renamed some methods, added explanations
parent
46fd2c35
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
src/Graph/Graph.java
+31
-16
31 additions, 16 deletions
src/Graph/Graph.java
src/Main.java
+1
-1
1 addition, 1 deletion
src/Main.java
src/RandomTreeAlgos/BreadthFirstSearch.java
+1
-1
1 addition, 1 deletion
src/RandomTreeAlgos/BreadthFirstSearch.java
with
33 additions
and
18 deletions
src/Graph/Graph.java
+
31
−
16
View file @
f49e231f
...
@@ -10,40 +10,55 @@ public class Graph {
...
@@ -10,40 +10,55 @@ public class Graph {
// pour pouvoir stocker un arbre couvrant, en plus du graphe
// pour pouvoir stocker un arbre couvrant, en plus du graphe
public
int
order
;
public
int
order
;
public
int
upperBound
;
int
edgeCardinality
;
int
edgeCardinality
;
ArrayList
<
LinkedList
<
Edge
>>
adjac
ency
;
ArrayList
<
LinkedList
<
Edge
>>
incid
ency
;
ArrayList
<
LinkedList
<
Arc
>>
in
Adjac
ency
;
ArrayList
<
LinkedList
<
Arc
>>
in
Incid
ency
;
ArrayList
<
LinkedList
<
Arc
>>
out
Adjac
ency
;
ArrayList
<
LinkedList
<
Arc
>>
out
Incid
ency
;
public
Graph
(
int
upperBound
)
{
public
Graph
(
int
upperBound
)
{
// à remplir
// Au début, upperBound==order
// Ensuite, on pourrait retirer des sommets du graphe.
// Ainsi, on pourrait avoir upperBound > order
// Cette modification de la classe devient nécessaire
// si vous implémentez la contraction d’arêtes
// Autrement, on pourra asssumer que upperBound==order.
// à compléter
}
}
public
boolean
isVertex
(
int
ind
ex
)
{
public
boolean
isVertex
(
int
vert
ex
)
{
// à
re
mpl
i
r
// à
co
mpl
éte
r
return
true
;
return
true
;
}
}
public
void
addVertex
(
int
indexVertex
)
{
public
void
addVertex
(
int
vertex
)
{
// à remplir
// à compléter
}
public
void
deleteVertex
(
int
vertex
){
// à compléter
}
}
public
void
ensureVertex
(
int
indexV
ertex
)
{
public
void
ensureVertex
(
int
v
ertex
)
{
// à
re
mpl
i
r
// à
co
mpl
éte
r
}
}
public
void
addArc
(
Arc
arc
)
{
public
void
addArc
(
Arc
arc
)
{
// à
re
mpl
i
r
// à
co
mpl
éte
r
}
}
public
void
addEdge
(
Edge
e
)
{
public
void
addEdge
(
Edge
edg
e
)
{
// à
re
mpl
i
r
// à
co
mpl
éte
r
}
}
public
Arc
[]
outNeighbours
(
int
sommet
)
{
public
Arc
[]
outEdges
(
int
vertex
)
{
// à remplir
// à modifier, si nécessaire
return
outAdjacency
.
get
(
sommet
).
toArray
(
new
Arc
[
0
]);
// Pour la prochaine ligne voir
// https://www.baeldung.com/java-collection-toarray-methods
return
outIncidency
.
get
(
vertex
).
toArray
(
new
Arc
[
0
]);
}
}
}
}
This diff is collapsed.
Click to expand it.
src/Main.java
+
1
−
1
View file @
f49e231f
...
@@ -36,7 +36,7 @@ public class Main {
...
@@ -36,7 +36,7 @@ public class Main {
private
static
Graph
chooseFromGraphFamily
()
{
private
static
Graph
chooseFromGraphFamily
()
{
// Parametriser ici cette fonction afin de pouvoir choisir
// Parametriser ici cette fonction afin de pouvoir choisir
// quelle classe de gra
o
he utiliser
// quelle classe de gra
p
he utiliser
grid
=
new
Grid
(
1920
/
11
,
1080
/
11
);
grid
=
new
Grid
(
1920
/
11
,
1080
/
11
);
Graph
graph
=
grid
.
graph
;
Graph
graph
=
grid
.
graph
;
...
...
This diff is collapsed.
Click to expand it.
src/RandomTreeAlgos/BreadthFirstSearch.java
+
1
−
1
View file @
f49e231f
...
@@ -14,7 +14,7 @@ public class BreadthFirstSearch {
...
@@ -14,7 +14,7 @@ public class BreadthFirstSearch {
BitSet
reached
;
BitSet
reached
;
private
void
push
(
int
vertex
)
{
private
void
push
(
int
vertex
)
{
for
(
Arc
arc
:
graph
.
out
Neighbour
s
(
vertex
))
frontier
.
offer
(
arc
);
for
(
Arc
arc
:
graph
.
out
Edge
s
(
vertex
))
frontier
.
offer
(
arc
);
}
}
private
void
explore
(
Arc
nextArc
)
{
private
void
explore
(
Arc
nextArc
)
{
...
...
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