adding graphopti
This commit is contained in:
@ -7,3 +7,9 @@ title = "Cours UMONS"
|
|||||||
|
|
||||||
[output.html]
|
[output.html]
|
||||||
mathjax-support = true
|
mathjax-support = true
|
||||||
|
additional-js = ["mermaid.min.js", "mermaid-init.js"]
|
||||||
|
|
||||||
|
[preprocessor]
|
||||||
|
|
||||||
|
[preprocessor.mermaid]
|
||||||
|
command = "mdbook-mermaid"
|
||||||
|
35
mermaid-init.js
Normal file
35
mermaid-init.js
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
(() => {
|
||||||
|
const darkThemes = ['ayu', 'navy', 'coal'];
|
||||||
|
const lightThemes = ['light', 'rust'];
|
||||||
|
|
||||||
|
const classList = document.getElementsByTagName('html')[0].classList;
|
||||||
|
|
||||||
|
let lastThemeWasLight = true;
|
||||||
|
for (const cssClass of classList) {
|
||||||
|
if (darkThemes.includes(cssClass)) {
|
||||||
|
lastThemeWasLight = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const theme = lastThemeWasLight ? 'default' : 'dark';
|
||||||
|
mermaid.initialize({ startOnLoad: true, theme });
|
||||||
|
|
||||||
|
// Simplest way to make mermaid re-render the diagrams in the new theme is via refreshing the page
|
||||||
|
|
||||||
|
for (const darkTheme of darkThemes) {
|
||||||
|
document.getElementById(darkTheme).addEventListener('click', () => {
|
||||||
|
if (lastThemeWasLight) {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const lightTheme of lightThemes) {
|
||||||
|
document.getElementById(lightTheme).addEventListener('click', () => {
|
||||||
|
if (!lastThemeWasLight) {
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
})();
|
2609
mermaid.min.js
vendored
Normal file
2609
mermaid.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -58,6 +58,10 @@
|
|||||||
# Bac3
|
# Bac3
|
||||||
|
|
||||||
- [Graph. et Opti.]()
|
- [Graph. et Opti.]()
|
||||||
|
- [définitions](./bac3/GraphOpti/Definitions.md)
|
||||||
|
- [Représentation](./bac3/GraphOpti/rpz.md)
|
||||||
|
- [Complexité](./bac3/GraphOpti/complexite.md)
|
||||||
|
- [Algos](./bac3/GraphOpti/Algos.md)
|
||||||
|
|
||||||
- [Statistiques]()
|
- [Statistiques]()
|
||||||
- [Introduction](./bac3/Stats/Introduction.md)
|
- [Introduction](./bac3/Stats/Introduction.md)
|
||||||
|
40
src/bac3/GraphOpti/Algos.md
Normal file
40
src/bac3/GraphOpti/Algos.md
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Algos
|
||||||
|
|
||||||
|
## Décompisition de graph en niveaux
|
||||||
|
|
||||||
|
1) Calculer \\( d^- \\)
|
||||||
|
2) incrémenter *layer*
|
||||||
|
3) pour chaques sommets, si \\( d^-(s) = 0 \\) alors définir sommets à layer
|
||||||
|
4) retirer sommets
|
||||||
|
5) recommencer jusqu'a ce qu'il n'y ai plus de sommets à explorer.
|
||||||
|
|
||||||
|
Il est possible d'incrémenter layer à chaque fois qu'un sommet est trouvé pour optenir une nouvelle
|
||||||
|
numérotation du graph qui respecterait l'ordre.
|
||||||
|
|
||||||
|
Cet algo ne fonctionnerais pas pour des graph cycliques.
|
||||||
|
|
||||||
|
## Exploration de graph
|
||||||
|
|
||||||
|
- Exploration en **Largeur** avec une **file** (BFS)
|
||||||
|
- Exploration en **Profondeur** avec une **pile** (DFS)
|
||||||
|
|
||||||
|
## Composantes connexes
|
||||||
|
|
||||||
|
On parle de composantes connexe comme un sous-graph tel qu'il existe une chaine entre chaques paire
|
||||||
|
de sommets.
|
||||||
|
|
||||||
|
Un sommet qui augmente les composants connexe si enlevé est appelé un **point d'articulation**
|
||||||
|
|
||||||
|
pour un graph non-dirigé: pour chaque sommets, faire une exploration et regrouper les sommets
|
||||||
|
visités en composants puis le supprimer pour continuer l'exploration.
|
||||||
|
|
||||||
|
Pour un graph dirigé, faire une detection de composantes fortements connexes.
|
||||||
|
|
||||||
|
## Détection d'un graph bi-partie
|
||||||
|
|
||||||
|
Pour la detection d'un graph bi-partie, il faut pour chaques sommets passer d'une couleur à l'autre.
|
||||||
|
si ça n'est pas possible, le graph n'est pas bi-partie.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
42
src/bac3/GraphOpti/Definitions.md
Normal file
42
src/bac3/GraphOpti/Definitions.md
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
# Définitions
|
||||||
|
|
||||||
|
- **Un graph**: \\( G = (X, U) \\) où \\( X \\) est l'ensemble de sommets et \\( U \\) est
|
||||||
|
l'ensemble de couple de sommets
|
||||||
|
- **Orienté**: si le sens est pris en compte
|
||||||
|
- **Non-orienté**: sinon
|
||||||
|
- soit \\( u = (x, y) \in U \\) on a que \\( x \\) est le **prédécesseur** et \\( y \\) est le
|
||||||
|
**succésseur**.
|
||||||
|
|
||||||
|
Dans le cas d'un **graph orienté**,
|
||||||
|
|
||||||
|
- \\( d^+(x) \\) le demi-degré extérieur, le nombre d'axe sortant
|
||||||
|
- \\( d^-(x) \\) le demi-degré intérieur, le nombre d'axe entrant
|
||||||
|
- \\( d(x) \\) le degré, le nombre d'axe en lien
|
||||||
|
|
||||||
|
- La **Densité d'un graph**:
|
||||||
|
- \\( \frac{||U||}{||X||(||X||-1)} \\) en pourcentage si **orienté**.
|
||||||
|
- \\( \frac{2||U||}{||X||(||X||-1)} \\) en pourcentage si **non-orienté**.
|
||||||
|
- Nous avons régulièrement des graphs peu dense.
|
||||||
|
|
||||||
|
- Un **Chemin** de largeur q est une séquence d'arc
|
||||||
|
- Un **Cycle** si cette chaine boucle
|
||||||
|
|
||||||
|
- Un graph **Connexe** possède une lien entre tout sommets.
|
||||||
|
- Si ça n'est pas le cas, il possède des **sous-graph**
|
||||||
|
- Un graph **Fortement connexe** si une chaine existe entre tout sommets
|
||||||
|
|
||||||
|
- Un graph est **Eulérien** s'il passe exactement 1 fois par chaque sommets
|
||||||
|
- Jeu de l'enveloppe
|
||||||
|
- On peut chercher à minimiser le nombre d'arc dans un graph non-eulérien: postier chinois
|
||||||
|
|
||||||
|
- Un graph est **Hamiltonien** s'il passe exclusivement une fois par chaques sommets
|
||||||
|
- Voyageur de commerce
|
||||||
|
|
||||||
|
- Un graph **Bi-partie** peut être divisé en deux groupe. Les éméteurs et les receveurs.
|
||||||
|
|
||||||
|
- Un graph est **Planaire** si on peut lne pas croiser d'arc **dans le plan**
|
||||||
|
- utile pour les circuits imprimés
|
||||||
|
- sa desitée maximale est \\( A_{max} = 3(S-2) \\)
|
||||||
|
|
||||||
|
- Un **Arbre** ne posède pas de cycle. Il est **exactement** convexe
|
||||||
|
- Un ensemble d'arbre est une **Foret**
|
26
src/bac3/GraphOpti/complexite.md
Normal file
26
src/bac3/GraphOpti/complexite.md
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Complexité
|
||||||
|
|
||||||
|
la **Complexité** \\( A \\) est une fonction non décroissante \\( f_A(k) \\) le nombre
|
||||||
|
d'instructions caractéristiques éxécuté par A pour une donnée de taille \\( k \\)
|
||||||
|
|
||||||
|
On parle de la **compléxité d'un problème** lorsque c'est celle du meilleur algo connu pour résoudre
|
||||||
|
ce problème.
|
||||||
|
|
||||||
|
Un problème d'optimisation est
|
||||||
|
\\[
|
||||||
|
f(s^*) = \min_{s \in S}\\{f(s)\\}
|
||||||
|
\\]
|
||||||
|
|
||||||
|
Un problème d'éxistance est un sous problème d'optimisation ou tq
|
||||||
|
|
||||||
|
Un problème d'optimisation est au moins aussi difficile que le problème d'existance associé
|
||||||
|
|
||||||
|
- **facile**: existe un algorithme polynomiale
|
||||||
|
- **difficile**: n'existe pas actuellement.
|
||||||
|
|
||||||
|
On donne la class **P** aux problèmes polynominaux et **NP** aux problème *vérifiables* en temps
|
||||||
|
polynominal.
|
||||||
|
|
||||||
|
\\[
|
||||||
|
NP \subseteq P
|
||||||
|
\\]
|
1
src/bac3/GraphOpti/complexité.md
Normal file
1
src/bac3/GraphOpti/complexité.md
Normal file
@ -0,0 +1 @@
|
|||||||
|
# Complexité
|
BIN
src/bac3/GraphOpti/liste_adjacence_pred.jpg
Normal file
BIN
src/bac3/GraphOpti/liste_adjacence_pred.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 164 KiB |
BIN
src/bac3/GraphOpti/liste_dadjacence.png
Normal file
BIN
src/bac3/GraphOpti/liste_dadjacence.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.1 KiB |
498
src/bac3/GraphOpti/liste_dadjacence.svg
Normal file
498
src/bac3/GraphOpti/liste_dadjacence.svg
Normal file
@ -0,0 +1,498 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="56.683983mm"
|
||||||
|
height="24.667534mm"
|
||||||
|
viewBox="0 0 56.683983 24.667534"
|
||||||
|
version="1.1"
|
||||||
|
id="svg1"
|
||||||
|
sodipodi:docname="liste_dadjacence.svg"
|
||||||
|
inkscape:version="1.4.2 (ebf0e940d0, 2025-05-08)"
|
||||||
|
inkscape:export-filename="liste_dadjacence.svg"
|
||||||
|
inkscape:export-xdpi="96"
|
||||||
|
inkscape:export-ydpi="96"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview1"
|
||||||
|
pagecolor="#505050"
|
||||||
|
bordercolor="#eeeeee"
|
||||||
|
borderopacity="1"
|
||||||
|
inkscape:showpageshadow="0"
|
||||||
|
inkscape:pageopacity="0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
inkscape:connector-spacing="8"
|
||||||
|
inkscape:zoom="3.9408307"
|
||||||
|
inkscape:cx="140.32574"
|
||||||
|
inkscape:cy="52.78075"
|
||||||
|
inkscape:window-width="1910"
|
||||||
|
inkscape:window-height="1040"
|
||||||
|
inkscape:window-x="5"
|
||||||
|
inkscape:window-y="35"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="svg1"
|
||||||
|
showguides="true">
|
||||||
|
<inkscape:page
|
||||||
|
x="0"
|
||||||
|
y="1.182968e-15"
|
||||||
|
width="56.683983"
|
||||||
|
height="24.667536"
|
||||||
|
id="page2"
|
||||||
|
margin="0"
|
||||||
|
bleed="0" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<defs
|
||||||
|
id="defs1">
|
||||||
|
<marker
|
||||||
|
style="overflow:visible"
|
||||||
|
id="ArrowWide"
|
||||||
|
refX="0"
|
||||||
|
refY="0"
|
||||||
|
orient="auto-start-reverse"
|
||||||
|
inkscape:stockid="Wide arrow"
|
||||||
|
markerWidth="1"
|
||||||
|
markerHeight="1"
|
||||||
|
viewBox="0 0 1 1"
|
||||||
|
inkscape:isstock="true"
|
||||||
|
inkscape:collect="always"
|
||||||
|
preserveAspectRatio="xMidYMid">
|
||||||
|
<path
|
||||||
|
style="fill:none;stroke:context-stroke;stroke-width:1;stroke-linecap:butt"
|
||||||
|
d="M 3,-3 0,0 3,3"
|
||||||
|
transform="rotate(180,0.125,0)"
|
||||||
|
sodipodi:nodetypes="ccc"
|
||||||
|
id="path1" />
|
||||||
|
</marker>
|
||||||
|
</defs>
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:#ffffff;fill-opacity:0.148131;fill-rule:evenodd;stroke:#000000;stroke-width:0.121988;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect11"
|
||||||
|
width="56.562"
|
||||||
|
height="24.545538"
|
||||||
|
x="0.060988639"
|
||||||
|
y="0.060994796"
|
||||||
|
inkscape:export-filename="liste_dadjacence.png"
|
||||||
|
inkscape:export-xdpi="96"
|
||||||
|
inkscape:export-ydpi="96" />
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-76.657815,-136.16624)">
|
||||||
|
<g
|
||||||
|
id="g11"
|
||||||
|
transform="translate(17.227086,-3.6865978)"
|
||||||
|
inkscape:export-filename="liste_dadjacence.svg"
|
||||||
|
inkscape:export-xdpi="96"
|
||||||
|
inkscape:export-ydpi="96">
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:none;fill-opacity:0.501676;fill-rule:evenodd;stroke:#000000;stroke-width:0.0572549;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect1"
|
||||||
|
width="4.9427452"
|
||||||
|
height="4.9427452"
|
||||||
|
x="73.681824"
|
||||||
|
y="146.02863"
|
||||||
|
inkscape:connector-avoid="true"
|
||||||
|
inkscape:export-filename="liste_dadjacence.svg"
|
||||||
|
inkscape:export-xdpi="96"
|
||||||
|
inkscape:export-ydpi="96" />
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:5.64444px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="61.700718"
|
||||||
|
y="150.38524"
|
||||||
|
id="text1"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan1"
|
||||||
|
style="font-size:5.64444px;line-height:1.25;stroke-width:0.264583"
|
||||||
|
x="61.700718"
|
||||||
|
y="150.38524">Head</tspan></text>
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:none;fill-opacity:0.501676;fill-rule:evenodd;stroke:#000000;stroke-width:0.0572549;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect6"
|
||||||
|
width="4.9427452"
|
||||||
|
height="4.9427452"
|
||||||
|
x="78.681824"
|
||||||
|
y="146.02863"
|
||||||
|
inkscape:connector-avoid="true" />
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:none;fill-opacity:0.501676;fill-rule:evenodd;stroke:#000000;stroke-width:0.0572549;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect7"
|
||||||
|
width="4.9427452"
|
||||||
|
height="4.9427452"
|
||||||
|
x="83.681824"
|
||||||
|
y="146.02863"
|
||||||
|
inkscape:connector-avoid="true" />
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:none;fill-opacity:0.501676;fill-rule:evenodd;stroke:#000000;stroke-width:0.0572549;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect8"
|
||||||
|
width="4.9427452"
|
||||||
|
height="4.9427452"
|
||||||
|
x="88.681824"
|
||||||
|
y="146.02863"
|
||||||
|
inkscape:connector-avoid="true" />
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:none;fill-opacity:0.501676;fill-rule:evenodd;stroke:#000000;stroke-width:0.0572549;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect9"
|
||||||
|
width="4.9427452"
|
||||||
|
height="4.9427452"
|
||||||
|
x="98.681824"
|
||||||
|
y="146.02863"
|
||||||
|
inkscape:connector-avoid="true" />
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:none;fill-opacity:0.501676;fill-rule:evenodd;stroke:#000000;stroke-width:0.0572549;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect10"
|
||||||
|
width="4.9427452"
|
||||||
|
height="4.9427452"
|
||||||
|
x="93.681824"
|
||||||
|
y="146.02863"
|
||||||
|
inkscape:connector-avoid="true" />
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:3.52777px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="75.597572"
|
||||||
|
y="149.68181"
|
||||||
|
id="text11"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan11"
|
||||||
|
x="75.597572"
|
||||||
|
y="149.68181"
|
||||||
|
style="stroke-width:0.264583">1</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:3.52777px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="80.156601"
|
||||||
|
y="149.68181"
|
||||||
|
id="text14"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan14"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="80.156601"
|
||||||
|
y="149.68181">4</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:3.52777px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="85.176003"
|
||||||
|
y="149.68181"
|
||||||
|
id="text15"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan15"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="85.176003"
|
||||||
|
y="149.68181">7</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:3.52777px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="90.176003"
|
||||||
|
y="149.68181"
|
||||||
|
id="text16"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan16"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="90.176003"
|
||||||
|
y="149.68181">7</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:3.52777px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="100.17248"
|
||||||
|
y="149.68004"
|
||||||
|
id="text17"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan17"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="100.17248"
|
||||||
|
y="149.68004">8</tspan><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="100.17248"
|
||||||
|
y="154.08975"
|
||||||
|
id="tspan18" /></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:3.52777px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="95.176003"
|
||||||
|
y="149.68181"
|
||||||
|
id="text19"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan19"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="95.176003"
|
||||||
|
y="149.68181">7</tspan></text>
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:none;fill-opacity:0.501676;fill-rule:evenodd;stroke:#000000;stroke-width:0.0572549;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect19"
|
||||||
|
width="4.9427452"
|
||||||
|
height="4.9427452"
|
||||||
|
x="73.681824"
|
||||||
|
y="156.18672"
|
||||||
|
inkscape:connector-avoid="true" />
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:5.64444px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="61.700718"
|
||||||
|
y="160.54333"
|
||||||
|
id="text20"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan20"
|
||||||
|
style="font-size:5.64444px;line-height:1.25;stroke-width:0.264583"
|
||||||
|
x="61.700718"
|
||||||
|
y="160.54333">Succ</tspan></text>
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:none;fill-opacity:0.501676;fill-rule:evenodd;stroke:#000000;stroke-width:0.0572549;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect20"
|
||||||
|
width="4.9427452"
|
||||||
|
height="4.9427452"
|
||||||
|
x="78.681824"
|
||||||
|
y="156.18672"
|
||||||
|
inkscape:connector-avoid="true" />
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:none;fill-opacity:0.501676;fill-rule:evenodd;stroke:#000000;stroke-width:0.0572549;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect21"
|
||||||
|
width="4.9427452"
|
||||||
|
height="4.9427452"
|
||||||
|
x="83.681824"
|
||||||
|
y="156.18672"
|
||||||
|
inkscape:connector-avoid="true" />
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:none;fill-opacity:0.501676;fill-rule:evenodd;stroke:#000000;stroke-width:0.0572549;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect22"
|
||||||
|
width="4.9427452"
|
||||||
|
height="4.9427452"
|
||||||
|
x="88.681824"
|
||||||
|
y="156.18672"
|
||||||
|
inkscape:connector-avoid="true" />
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:none;fill-opacity:0.501676;fill-rule:evenodd;stroke:#000000;stroke-width:0.0572549;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect23"
|
||||||
|
width="4.9427452"
|
||||||
|
height="4.9427452"
|
||||||
|
x="98.681824"
|
||||||
|
y="156.18672"
|
||||||
|
inkscape:connector-avoid="true" />
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:none;fill-opacity:0.501676;fill-rule:evenodd;stroke:#000000;stroke-width:0.0572549;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect24"
|
||||||
|
width="4.9427452"
|
||||||
|
height="4.9427452"
|
||||||
|
x="93.681824"
|
||||||
|
y="156.18672"
|
||||||
|
inkscape:connector-avoid="true" />
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:3.52777px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="75.116035"
|
||||||
|
y="159.8593"
|
||||||
|
id="text24"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan24"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="75.116035"
|
||||||
|
y="159.8593">2</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:3.52777px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="80.184822"
|
||||||
|
y="159.83636"
|
||||||
|
id="text25"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan25"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="80.184822"
|
||||||
|
y="159.83636">3</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:3.52777px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="85.156601"
|
||||||
|
y="159.8399"
|
||||||
|
id="text26"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan26"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="85.156601"
|
||||||
|
y="159.8399">4</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:3.52777px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="90.597572"
|
||||||
|
y="159.8399"
|
||||||
|
id="text27"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan27"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="90.597572"
|
||||||
|
y="159.8399">1</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:3.52777px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="95.184822"
|
||||||
|
y="159.83636"
|
||||||
|
id="text28"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan28"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="95.184822"
|
||||||
|
y="159.83636">3</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:3.52777px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="100.1566"
|
||||||
|
y="159.8399"
|
||||||
|
id="text29"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan29"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="100.1566"
|
||||||
|
y="159.8399">4</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:3.52777px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="105.1566"
|
||||||
|
y="159.8399"
|
||||||
|
id="text30"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan30"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="105.1566"
|
||||||
|
y="159.8399">4</tspan></text>
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:none;fill-opacity:0.501676;fill-rule:evenodd;stroke:#000000;stroke-width:0.0572549;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect30"
|
||||||
|
width="4.9427452"
|
||||||
|
height="4.9427452"
|
||||||
|
x="103.68182"
|
||||||
|
y="156.18672"
|
||||||
|
inkscape:connector-avoid="true" />
|
||||||
|
<path
|
||||||
|
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#ArrowWide)"
|
||||||
|
d="m 76.153196,150.97137 v 5.21535"
|
||||||
|
id="path30"
|
||||||
|
inkscape:connector-type="polyline"
|
||||||
|
inkscape:connector-curvature="7"
|
||||||
|
inkscape:connection-start="#rect1"
|
||||||
|
inkscape:connection-end="#rect19" />
|
||||||
|
<path
|
||||||
|
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#ArrowWide)"
|
||||||
|
d="m 83.586106,150.97137 5.134181,5.21535"
|
||||||
|
id="path31"
|
||||||
|
inkscape:connector-type="polyline"
|
||||||
|
inkscape:connector-curvature="7"
|
||||||
|
inkscape:connection-start="#rect6"
|
||||||
|
inkscape:connection-end="#rect22"
|
||||||
|
sodipodi:nodetypes="cc" />
|
||||||
|
<path
|
||||||
|
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#ArrowWide)"
|
||||||
|
d="m 93.624569,150.17363 10.057251,6.81084"
|
||||||
|
id="path32"
|
||||||
|
inkscape:connector-type="polyline"
|
||||||
|
inkscape:connector-curvature="7"
|
||||||
|
inkscape:connection-start="#rect8"
|
||||||
|
inkscape:connection-end="#rect30"
|
||||||
|
sodipodi:nodetypes="cc" />
|
||||||
|
<path
|
||||||
|
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||||
|
d="m 96.153196,148.5 v 0"
|
||||||
|
id="path33"
|
||||||
|
inkscape:connector-type="orthogonal"
|
||||||
|
inkscape:connector-curvature="6"
|
||||||
|
inkscape:connection-start="#rect10"
|
||||||
|
inkscape:connection-end="#rect10" />
|
||||||
|
<path
|
||||||
|
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#ArrowWide)"
|
||||||
|
d="m 98.586106,150.97137 5.134184,5.21535"
|
||||||
|
id="path34"
|
||||||
|
inkscape:connector-type="polyline"
|
||||||
|
inkscape:connector-curvature="7"
|
||||||
|
inkscape:connection-start="#rect10"
|
||||||
|
inkscape:connection-end="#rect30"
|
||||||
|
sodipodi:nodetypes="cc" />
|
||||||
|
<rect
|
||||||
|
style="opacity:0.99;fill:none;fill-opacity:0.501676;fill-rule:evenodd;stroke:#000000;stroke-width:0.0572549;stroke-linecap:round;paint-order:fill markers stroke"
|
||||||
|
id="rect35"
|
||||||
|
width="4.9427452"
|
||||||
|
height="4.9427452"
|
||||||
|
x="108.68182"
|
||||||
|
y="156.18672"
|
||||||
|
inkscape:connector-avoid="true" />
|
||||||
|
<path
|
||||||
|
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:0.264583px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#ArrowWide)"
|
||||||
|
d="m 103.58611,150.97137 5.13418,5.21535"
|
||||||
|
id="path35"
|
||||||
|
inkscape:connector-type="polyline"
|
||||||
|
inkscape:connector-curvature="7"
|
||||||
|
inkscape:connection-end="#rect35"
|
||||||
|
sodipodi:nodetypes="cc"
|
||||||
|
inkscape:connection-start="#rect9" />
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:2.82223px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="75.708694"
|
||||||
|
y="145.13986"
|
||||||
|
id="text2"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan2"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="75.708694"
|
||||||
|
y="145.13986">1</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:2.82223px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="80.323463"
|
||||||
|
y="145.1554"
|
||||||
|
id="text3"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan3"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="80.323463"
|
||||||
|
y="145.1554">2</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:2.82223px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="85.378494"
|
||||||
|
y="145.13704"
|
||||||
|
id="text4"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan4"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="85.378494"
|
||||||
|
y="145.13704">3</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:2.82223px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="90.355911"
|
||||||
|
y="145.13986"
|
||||||
|
id="text5"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan5"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="90.355911"
|
||||||
|
y="145.13986">4</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:2.82223px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="95.371437"
|
||||||
|
y="145.12294"
|
||||||
|
id="text6"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan6"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="95.371437"
|
||||||
|
y="145.12294">5</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:2.82223px;line-height:1.25;font-family:'Highway Gothic';-inkscape-font-specification:'Highway Gothic';stroke-width:0.264583"
|
||||||
|
x="100.36861"
|
||||||
|
y="145.13846"
|
||||||
|
id="text7"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan7"
|
||||||
|
style="stroke-width:0.264583"
|
||||||
|
x="100.36861"
|
||||||
|
y="145.13846">6</tspan></text>
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 19 KiB |
32
src/bac3/GraphOpti/rpz.md
Normal file
32
src/bac3/GraphOpti/rpz.md
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# Représentation
|
||||||
|
|
||||||
|
Les graphs peuvent être représenté à l'aide de matrice d'adjacence tel que
|
||||||
|
\\[
|
||||||
|
\begin{cases}
|
||||||
|
(i, j) = 1 &\text{ si } (i,j) \in U\\\\
|
||||||
|
0 &\text{ sinon }
|
||||||
|
\end{cases}
|
||||||
|
\\]
|
||||||
|
|
||||||
|
On y trouve facilement les successeurs en ligne et les prédécesseurs en colones. Mais il faut faire
|
||||||
|
énormément d'opérations pour vérifier un sommet...
|
||||||
|
|
||||||
|
Nous adoptons alors les **listes d'adjacences**. Cette structure possède 2 liste. Une est la
|
||||||
|
tête (head) et possède autant d'espace que de sommets et est remplie avec des pointeurs vers la
|
||||||
|
deuxième liste, celle-ci contient les successeurs d'un sommet.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
On peut alors transformer la liste de successeurs en liste de prédécésseurs
|
||||||
|
|
||||||
|
1) calculer \\( d^- \\)
|
||||||
|
2) placer dans le nouveau head \\( 1 + \sum^j_i d^-_i\\) où j est la position
|
||||||
|
3) pour chaques arcs \\( (i,j) \\) dans l'ordre de succ,
|
||||||
|
1) réduire \\( Head_j \\) de 1
|
||||||
|
2) placer i dans \\( Pred_{(Head_j)} \\)
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
**Remarque**: une fois un graph sous cette forme il est souvent plus difficile de le remttre sous
|
||||||
|
forme de dessin car les nodes n'ont pas de place définies.
|
Reference in New Issue
Block a user