[OPT] TP 5
This commit is contained in:
parent
2ceee1fa2c
commit
81f23fb737
@ -6,7 +6,7 @@ lastDocument=Questions.tex
|
|||||||
|
|
||||||
[document-settings,item:Questions.tex]
|
[document-settings,item:Questions.tex]
|
||||||
Bookmarks=
|
Bookmarks=
|
||||||
Encoding=
|
Encoding=UTF-8
|
||||||
Highlighting=LaTeX
|
Highlighting=LaTeX
|
||||||
Highlighting Set By User=false
|
Highlighting Set By User=false
|
||||||
Indentation Mode=normal
|
Indentation Mode=normal
|
||||||
@ -22,8 +22,8 @@ open=false
|
|||||||
order=-1
|
order=-1
|
||||||
|
|
||||||
[view-settings,view=0,item:Questions.tex]
|
[view-settings,view=0,item:Questions.tex]
|
||||||
CursorColumn=14
|
CursorColumn=0
|
||||||
CursorLine=35
|
CursorLine=27
|
||||||
Dynamic Word Wrap=true
|
Dynamic Word Wrap=true
|
||||||
JumpList=
|
JumpList=
|
||||||
TextFolding=[]
|
TextFolding=[]
|
||||||
|
@ -20,7 +20,7 @@ QuickBuild=
|
|||||||
|
|
||||||
[item:Questions.tex]
|
[item:Questions.tex]
|
||||||
archive=true
|
archive=true
|
||||||
encoding=
|
encoding=UTF-8
|
||||||
highlight=LaTeX
|
highlight=LaTeX
|
||||||
mode=LaTeX
|
mode=LaTeX
|
||||||
|
|
||||||
|
@ -2,12 +2,29 @@
|
|||||||
kile_livePreviewEnabled=true
|
kile_livePreviewEnabled=true
|
||||||
kile_livePreviewStatusUserSpecified=false
|
kile_livePreviewStatusUserSpecified=false
|
||||||
kile_livePreviewTool=LivePreview-PDFLaTeX
|
kile_livePreviewTool=LivePreview-PDFLaTeX
|
||||||
lastDocument=
|
lastDocument=Questions.tex
|
||||||
|
|
||||||
|
[document-settings,item:Questions.tex]
|
||||||
|
Bookmarks=
|
||||||
|
Encoding=UTF-8
|
||||||
|
Highlighting=LaTeX
|
||||||
|
Highlighting Set By User=false
|
||||||
|
Indentation Mode=normal
|
||||||
|
Mode=LaTeX
|
||||||
|
Mode Set By User=false
|
||||||
|
|
||||||
[item:Questions.tex]
|
[item:Questions.tex]
|
||||||
open=true
|
open=true
|
||||||
order=-1
|
order=0
|
||||||
|
|
||||||
[item:questions.kilepr]
|
[item:questions.kilepr]
|
||||||
open=false
|
open=false
|
||||||
order=-1
|
order=-1
|
||||||
|
|
||||||
|
[view-settings,view=0,item:Questions.tex]
|
||||||
|
CursorColumn=18
|
||||||
|
CursorLine=32
|
||||||
|
Dynamic Word Wrap=true
|
||||||
|
JumpList=
|
||||||
|
TextFolding=[]
|
||||||
|
ViMarks=.,32,18,[,32,18,],32,18
|
||||||
|
@ -31,5 +31,4 @@
|
|||||||
S'il y a reconstruction, dans le pire des cas, cette reconstruction s'effectue sur l'arbre entier en $O(n)$ puis puisque la reconstruction crée un arbre dont tous les noeuds sont équilibrés, il n'y aura donc pas d'autre reconstruction. Ainsi en notant $C_h$ la complexité d'un appel entrainant une reconstruction, on a : $$C_h = O(n) + c_h = O(n) + O(lg(n)) = O(n)$$
|
S'il y a reconstruction, dans le pire des cas, cette reconstruction s'effectue sur l'arbre entier en $O(n)$ puis puisque la reconstruction crée un arbre dont tous les noeuds sont équilibrés, il n'y aura donc pas d'autre reconstruction. Ainsi en notant $C_h$ la complexité d'un appel entrainant une reconstruction, on a : $$C_h = O(n) + c_h = O(n) + O(lg(n)) = O(n)$$
|
||||||
CQFD (ça va, c'est pas si pénible que ça les maths (de ce niveau là en tout cas))
|
CQFD (ça va, c'est pas si pénible que ça les maths (de ce niveau là en tout cas))
|
||||||
\end{enumerate}
|
\end{enumerate}
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
@ -20,9 +20,9 @@ QuickBuild=
|
|||||||
|
|
||||||
[item:Questions.tex]
|
[item:Questions.tex]
|
||||||
archive=true
|
archive=true
|
||||||
encoding=
|
encoding=UTF-8
|
||||||
highlight=
|
highlight=LaTeX
|
||||||
mode=
|
mode=LaTeX
|
||||||
|
|
||||||
[item:questions.kilepr]
|
[item:questions.kilepr]
|
||||||
archive=true
|
archive=true
|
||||||
|
30
SPE/OPT/TP 5/.kile/questions.kilepr.gui
Normal file
30
SPE/OPT/TP 5/.kile/questions.kilepr.gui
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
[General]
|
||||||
|
kile_livePreviewEnabled=true
|
||||||
|
kile_livePreviewStatusUserSpecified=false
|
||||||
|
kile_livePreviewTool=LivePreview-PDFLaTeX
|
||||||
|
lastDocument=Questions.tex
|
||||||
|
|
||||||
|
[document-settings,item:Questions.tex]
|
||||||
|
Bookmarks=
|
||||||
|
Encoding=UTF-8
|
||||||
|
Highlighting=LaTeX
|
||||||
|
Highlighting Set By User=false
|
||||||
|
Indentation Mode=normal
|
||||||
|
Mode=LaTeX
|
||||||
|
Mode Set By User=false
|
||||||
|
|
||||||
|
[item:Questions.tex]
|
||||||
|
open=true
|
||||||
|
order=0
|
||||||
|
|
||||||
|
[item:questions.kilepr]
|
||||||
|
open=false
|
||||||
|
order=-1
|
||||||
|
|
||||||
|
[view-settings,view=0,item:Questions.tex]
|
||||||
|
CursorColumn=32
|
||||||
|
CursorLine=5
|
||||||
|
Dynamic Word Wrap=true
|
||||||
|
JumpList=
|
||||||
|
TextFolding=[]
|
||||||
|
ViMarks=.,26,158,[,26,158,],26,158
|
2
SPE/OPT/TP 5/Questions.aux
Normal file
2
SPE/OPT/TP 5/Questions.aux
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
\relax
|
||||||
|
\@writefile{toc}{\contentsline {section}{\numberline {I}Graphes définis par listes d'adjacences}{1}\protected@file@percent }
|
212
SPE/OPT/TP 5/Questions.log
Normal file
212
SPE/OPT/TP 5/Questions.log
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020 Gentoo Linux) (preloaded format=pdflatex 2020.11.24) 2 DEC 2020 22:33
|
||||||
|
entering extended mode
|
||||||
|
restricted \write18 enabled.
|
||||||
|
%&-line parsing enabled.
|
||||||
|
**Questions.tex
|
||||||
|
(./Questions.tex
|
||||||
|
LaTeX2e <2020-02-02> patch level 5
|
||||||
|
L3 programming layer <2020-02-25>
|
||||||
|
(/usr/share/texmf-dist/tex/latex/base/article.cls
|
||||||
|
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
|
||||||
|
(/usr/share/texmf-dist/tex/latex/base/size10.clo
|
||||||
|
File: size10.clo 2019/12/20 v1.4l Standard LaTeX file (size option)
|
||||||
|
)
|
||||||
|
\c@part=\count167
|
||||||
|
\c@section=\count168
|
||||||
|
\c@subsection=\count169
|
||||||
|
\c@subsubsection=\count170
|
||||||
|
\c@paragraph=\count171
|
||||||
|
\c@subparagraph=\count172
|
||||||
|
\c@figure=\count173
|
||||||
|
\c@table=\count174
|
||||||
|
\abovecaptionskip=\skip47
|
||||||
|
\belowcaptionskip=\skip48
|
||||||
|
\bibindent=\dimen134
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/mathtools/mathtools.sty
|
||||||
|
Package: mathtools 2020/01/17 v1.23 mathematical typesetting tools
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/graphics/keyval.sty
|
||||||
|
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
|
||||||
|
\KV@toks@=\toks15
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/tools/calc.sty
|
||||||
|
Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
|
||||||
|
\calc@Acount=\count175
|
||||||
|
\calc@Bcount=\count176
|
||||||
|
\calc@Adimen=\dimen135
|
||||||
|
\calc@Bdimen=\dimen136
|
||||||
|
\calc@Askip=\skip49
|
||||||
|
\calc@Bskip=\skip50
|
||||||
|
LaTeX Info: Redefining \setlength on input line 80.
|
||||||
|
LaTeX Info: Redefining \addtolength on input line 81.
|
||||||
|
\calc@Ccount=\count177
|
||||||
|
\calc@Cskip=\skip51
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/mathtools/mhsetup.sty
|
||||||
|
Package: mhsetup 2017/03/31 v1.3 programming setup (MH)
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/amsmath/amsmath.sty
|
||||||
|
Package: amsmath 2020/01/20 v2.17e AMS math features
|
||||||
|
\@mathmargin=\skip52
|
||||||
|
|
||||||
|
For additional information on amsmath, use the `?' option.
|
||||||
|
(/usr/share/texmf-dist/tex/latex/amsmath/amstext.sty
|
||||||
|
Package: amstext 2000/06/29 v2.01 AMS text
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/amsmath/amsgen.sty
|
||||||
|
File: amsgen.sty 1999/11/30 v2.0 generic functions
|
||||||
|
\@emptytoks=\toks16
|
||||||
|
\ex@=\dimen137
|
||||||
|
))
|
||||||
|
(/usr/share/texmf-dist/tex/latex/amsmath/amsbsy.sty
|
||||||
|
Package: amsbsy 1999/11/29 v1.2d Bold Symbols
|
||||||
|
\pmbraise@=\dimen138
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/amsmath/amsopn.sty
|
||||||
|
Package: amsopn 2016/03/08 v2.02 operator names
|
||||||
|
)
|
||||||
|
\inf@bad=\count178
|
||||||
|
LaTeX Info: Redefining \frac on input line 227.
|
||||||
|
\uproot@=\count179
|
||||||
|
\leftroot@=\count180
|
||||||
|
LaTeX Info: Redefining \overline on input line 389.
|
||||||
|
\classnum@=\count181
|
||||||
|
\DOTSCASE@=\count182
|
||||||
|
LaTeX Info: Redefining \ldots on input line 486.
|
||||||
|
LaTeX Info: Redefining \dots on input line 489.
|
||||||
|
LaTeX Info: Redefining \cdots on input line 610.
|
||||||
|
\Mathstrutbox@=\box45
|
||||||
|
\strutbox@=\box46
|
||||||
|
\big@size=\dimen139
|
||||||
|
LaTeX Font Info: Redeclaring font encoding OML on input line 733.
|
||||||
|
LaTeX Font Info: Redeclaring font encoding OMS on input line 734.
|
||||||
|
\macc@depth=\count183
|
||||||
|
\c@MaxMatrixCols=\count184
|
||||||
|
\dotsspace@=\muskip16
|
||||||
|
\c@parentequation=\count185
|
||||||
|
\dspbrk@lvl=\count186
|
||||||
|
\tag@help=\toks17
|
||||||
|
\row@=\count187
|
||||||
|
\column@=\count188
|
||||||
|
\maxfields@=\count189
|
||||||
|
\andhelp@=\toks18
|
||||||
|
\eqnshift@=\dimen140
|
||||||
|
\alignsep@=\dimen141
|
||||||
|
\tagshift@=\dimen142
|
||||||
|
\tagwidth@=\dimen143
|
||||||
|
\totwidth@=\dimen144
|
||||||
|
\lineht@=\dimen145
|
||||||
|
\@envbody=\toks19
|
||||||
|
\multlinegap=\skip53
|
||||||
|
\multlinetaggap=\skip54
|
||||||
|
\mathdisplay@stack=\toks20
|
||||||
|
LaTeX Info: Redefining \[ on input line 2859.
|
||||||
|
LaTeX Info: Redefining \] on input line 2860.
|
||||||
|
)
|
||||||
|
LaTeX Info: Thecontrolsequence`\('isalreadyrobust on input line 129.
|
||||||
|
LaTeX Info: Thecontrolsequence`\)'isalreadyrobust on input line 129.
|
||||||
|
LaTeX Info: Thecontrolsequence`\['isalreadyrobust on input line 129.
|
||||||
|
LaTeX Info: Thecontrolsequence`\]'isalreadyrobust on input line 129.
|
||||||
|
\g_MT_multlinerow_int=\count190
|
||||||
|
\l_MT_multwidth_dim=\dimen146
|
||||||
|
\origjot=\skip55
|
||||||
|
\l_MT_shortvdotswithinadjustabove_dim=\dimen147
|
||||||
|
\l_MT_shortvdotswithinadjustbelow_dim=\dimen148
|
||||||
|
\l_MT_above_intertext_sep=\dimen149
|
||||||
|
\l_MT_below_intertext_sep=\dimen150
|
||||||
|
\l_MT_above_shortintertext_sep=\dimen151
|
||||||
|
\l_MT_below_shortintertext_sep=\dimen152
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/base/inputenc.sty
|
||||||
|
Package: inputenc 2018/08/11 v1.3c Input encoding file
|
||||||
|
\inpenc@prehook=\toks21
|
||||||
|
\inpenc@posthook=\toks22
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def
|
||||||
|
File: l3backend-pdfmode.def 2020-02-23 L3 backend support: PDF mode
|
||||||
|
\l__kernel_color_stack_int=\count191
|
||||||
|
\l__pdf_internal_box=\box47
|
||||||
|
)
|
||||||
|
(./Questions.aux)
|
||||||
|
\openout1 = `Questions.aux'.
|
||||||
|
|
||||||
|
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 22.
|
||||||
|
LaTeX Font Info: ... okay on input line 22.
|
||||||
|
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 22.
|
||||||
|
LaTeX Font Info: ... okay on input line 22.
|
||||||
|
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 22.
|
||||||
|
LaTeX Font Info: ... okay on input line 22.
|
||||||
|
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 22.
|
||||||
|
LaTeX Font Info: ... okay on input line 22.
|
||||||
|
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 22.
|
||||||
|
LaTeX Font Info: ... okay on input line 22.
|
||||||
|
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 22.
|
||||||
|
LaTeX Font Info: ... okay on input line 22.
|
||||||
|
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 22.
|
||||||
|
LaTeX Font Info: ... okay on input line 22.
|
||||||
|
(/usr/share/texmf-dist/tex/latex/graphics/graphicx.sty
|
||||||
|
Package: graphicx 2019/11/30 v1.2a Enhanced LaTeX Graphics (DPC,SPQR)
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/graphics/graphics.sty
|
||||||
|
Package: graphics 2019/11/30 v1.4a Standard LaTeX Graphics (DPC,SPQR)
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/graphics/trig.sty
|
||||||
|
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
|
||||||
|
)
|
||||||
|
(/usr/share/texmf-dist/tex/latex/graphics-cfg/graphics.cfg
|
||||||
|
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
|
||||||
|
)
|
||||||
|
Package graphics Info: Driver file: pdftex.def on input line 105.
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/graphics-def/pdftex.def
|
||||||
|
File: pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
|
||||||
|
[Loading MPS to PDF converter (version 2006.09.02).]
|
||||||
|
\scratchcounter=\count192
|
||||||
|
\scratchdimen=\dimen153
|
||||||
|
\scratchbox=\box48
|
||||||
|
\nofMPsegments=\count193
|
||||||
|
\nofMParguments=\count194
|
||||||
|
\everyMPshowfont=\toks23
|
||||||
|
\MPscratchCnt=\count195
|
||||||
|
\MPscratchDim=\dimen154
|
||||||
|
\MPnumerator=\count196
|
||||||
|
\makeMPintoPDFobject=\count197
|
||||||
|
\everyMPtoPDFconversion=\toks24
|
||||||
|
))) (/usr/share/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty
|
||||||
|
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
|
||||||
|
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
|
||||||
|
85.
|
||||||
|
|
||||||
|
(/usr/share/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
|
||||||
|
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
|
||||||
|
e
|
||||||
|
))
|
||||||
|
\Gin@req@height=\dimen155
|
||||||
|
\Gin@req@width=\dimen156
|
||||||
|
) [1
|
||||||
|
|
||||||
|
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./Questions.aux) )
|
||||||
|
Here is how much of TeX's memory you used:
|
||||||
|
2365 strings out of 482906
|
||||||
|
33874 string characters out of 5959890
|
||||||
|
271219 words of memory out of 5000000
|
||||||
|
17641 multiletter control sequences out of 15000+600000
|
||||||
|
537414 words of font info for 42 fonts, out of 8000000 for 9000
|
||||||
|
14 hyphenation exceptions out of 8191
|
||||||
|
37i,4n,29p,298b,185s stack positions out of 5000i,500n,10000p,200000b,80000s
|
||||||
|
</usr/s
|
||||||
|
hare/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/share/texmf-dis
|
||||||
|
t/fonts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/texmf-dist/fonts/type1/
|
||||||
|
public/amsfonts/cm/cmr10.pfb></usr/share/texmf-dist/fonts/type1/public/amsfonts
|
||||||
|
/cm/cmr17.pfb></usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb>
|
||||||
|
|
||||||
|
Output written on Questions.pdf (1 page, 56336 bytes).
|
||||||
|
PDF statistics:
|
||||||
|
28 PDF objects out of 1000 (max. 8388607)
|
||||||
|
19 compressed objects within 1 object stream
|
||||||
|
0 named destinations out of 1000 (max. 500000)
|
||||||
|
1 words of extra memory for PDF output out of 10000 (max. 10000000)
|
||||||
|
|
BIN
SPE/OPT/TP 5/Questions.pdf
Normal file
BIN
SPE/OPT/TP 5/Questions.pdf
Normal file
Binary file not shown.
BIN
SPE/OPT/TP 5/Questions.synctex.gz
Normal file
BIN
SPE/OPT/TP 5/Questions.synctex.gz
Normal file
Binary file not shown.
31
SPE/OPT/TP 5/Questions.tex
Normal file
31
SPE/OPT/TP 5/Questions.tex
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
\documentclass[a4paper,10pt]{article}
|
||||||
|
%\documentclass[a4paper,10pt]{scrartcl}
|
||||||
|
\usepackage{mathtools}
|
||||||
|
|
||||||
|
\usepackage[utf8]{inputenc}
|
||||||
|
\renewcommand{\thesection}{\Roman{section}}
|
||||||
|
\newcommand{\sectioni}[2]{\setcounter{section}{#1}\addtocounter{section}{-1}\section{#2}}
|
||||||
|
\newcommand{\subsectioni}[2]{\setcounter{subsection}{#1}\addtocounter{subsection}{-1}\subsection{#2}}
|
||||||
|
\title{Questions du TP 5}
|
||||||
|
\author{}
|
||||||
|
\date{}
|
||||||
|
|
||||||
|
\pdfinfo{%
|
||||||
|
/Title ()
|
||||||
|
/Author ()
|
||||||
|
/Creator ()
|
||||||
|
/Producer ()
|
||||||
|
/Subject ()
|
||||||
|
/Keywords ()
|
||||||
|
}
|
||||||
|
|
||||||
|
\begin{document}
|
||||||
|
\maketitle
|
||||||
|
\section{Graphes définis par listes d'adjacences}
|
||||||
|
\begin{enumerate}
|
||||||
|
\item Si le graphe n'est est orienté, au lieu d'ajouter \textbf{j} à \textbf{g.(i)} et \textbf{i} à \textbf{g.(j)}, on se contente d'ajouter j à g.(i).
|
||||||
|
\item De même, au lieu de retirer \textbf{j} de \textbf{g.(i)} et \textbf{i} de \textbf{g.(j)}, on se contente de retirer \textbf{j} de \textbf{g.(i)}.
|
||||||
|
\item Ici on a \textbf{ajoute\_sommet : int $\rightarrow$ int $\rightarrow$ graphe1 $\rightarrow$ graphe1}, or l'appel d'exemple est \textbf{ajoute\_sommet g}. On supposera que \textbf{ajoute\_sommet} est du type : \textbf{graphe1 $\rightarrow$ graphe1}.
|
||||||
|
\end{enumerate}
|
||||||
|
|
||||||
|
\end{document}
|
95
SPE/OPT/TP 5/main.ml
Normal file
95
SPE/OPT/TP 5/main.ml
Normal file
@ -0,0 +1,95 @@
|
|||||||
|
type graphel = int list array;;
|
||||||
|
|
||||||
|
let ajoute_arete i j (g:graphel) =
|
||||||
|
let rec ajoute k l = match l with
|
||||||
|
| [] -> [k]
|
||||||
|
| h::t when h=k -> h::(ajoute k t)
|
||||||
|
| h::t -> l in
|
||||||
|
g.(i) <- ajoute j g.(i);
|
||||||
|
g.(j) <- ajoute i g.(j);;
|
||||||
|
|
||||||
|
let supprime_arete i j (g:graphel) =
|
||||||
|
let rec retire k l = match l with
|
||||||
|
| h::t when h=k -> t
|
||||||
|
| h::t -> h::(retire k t)
|
||||||
|
| _ -> l in
|
||||||
|
g.(i) <- retire j g.(i);
|
||||||
|
g.(j) <- retire i g.(j);;
|
||||||
|
|
||||||
|
let ajoute_sommet (g:graphel) =
|
||||||
|
let n = Array.length g in
|
||||||
|
let g2 = Array.make (n+1) [] in
|
||||||
|
for i = 0 to n-1 do
|
||||||
|
g2.(i) <- g.(i)
|
||||||
|
done;
|
||||||
|
g2;;
|
||||||
|
|
||||||
|
let supprime_sommet i (g:graphel) =
|
||||||
|
let n = Array.length g in
|
||||||
|
let g2 = Array.make (n-1) [] in
|
||||||
|
let rec parcours l = match l with
|
||||||
|
| [] -> []
|
||||||
|
| h::t when h=i -> parcours t
|
||||||
|
| h::t when h<i -> h::(parcours t)
|
||||||
|
| h::t when h>i -> (h-1)::(parcours t) in
|
||||||
|
for j = 0 to n-2 do
|
||||||
|
if j < i then
|
||||||
|
g2.(j) <- parcours g.(j)
|
||||||
|
else
|
||||||
|
g2.(j) <- parcours g.(j+1)
|
||||||
|
done;
|
||||||
|
g2;;
|
||||||
|
|
||||||
|
type graphem = int array array;;
|
||||||
|
|
||||||
|
let ajoute_aretem i j (g:graphem) =
|
||||||
|
g.(i).(j) <- 1;
|
||||||
|
g.(j).(i) <- 1;;
|
||||||
|
|
||||||
|
let supprime_aretem i j (g:graphem) =
|
||||||
|
g.(i).(j) <- 0;
|
||||||
|
g.(j).(i) <- 0;;
|
||||||
|
|
||||||
|
let ajoute_sommetm (g:graphem) =
|
||||||
|
let n = Array.length g in
|
||||||
|
let g2 = Array.make_matrix n n 0 in
|
||||||
|
for i = 0 to n-1 do
|
||||||
|
for j = 0 to n-1 do
|
||||||
|
g2.(i).(j) <- g.(i).(j)
|
||||||
|
done
|
||||||
|
done;
|
||||||
|
g2;;
|
||||||
|
|
||||||
|
let supprime_sommetm k (g:graphem) =
|
||||||
|
let n = Array.length g in
|
||||||
|
let g2 = Array.make_matrix (n-1) (n-1) 0 in
|
||||||
|
for i = 0 to n-2 do
|
||||||
|
for j = 0 to n-2 do
|
||||||
|
let a = if i < k then i else i+1 in
|
||||||
|
let b = if j < k then j else j+1 in
|
||||||
|
g2.(i).(j) <- g.(a).(b)
|
||||||
|
done
|
||||||
|
done;
|
||||||
|
g2;;
|
||||||
|
|
||||||
|
let conversion_lm (g:graphel) =
|
||||||
|
let n = Array.length g in
|
||||||
|
let g2 = Array.make_matrix n n 0 in
|
||||||
|
for i = 0 to n-1 do
|
||||||
|
let ajoute j = ajoute_aretem i j g2 in
|
||||||
|
List.map ajoute g.(i)
|
||||||
|
done;
|
||||||
|
g2;;
|
||||||
|
|
||||||
|
let conversion_ml (g:graphem) =
|
||||||
|
let n = Array.length g in
|
||||||
|
let g2 = Array.make n [] in
|
||||||
|
for i = 0 to n-1 do
|
||||||
|
for j = 0 to n-1 do
|
||||||
|
if g.(i).(j) = 1 then
|
||||||
|
ajoute_arete i j g2
|
||||||
|
else ()
|
||||||
|
done
|
||||||
|
done;
|
||||||
|
g2;;
|
||||||
|
|
31
SPE/OPT/TP 5/questions.kilepr
Normal file
31
SPE/OPT/TP 5/questions.kilepr
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
[General]
|
||||||
|
bib_extensions=.bib
|
||||||
|
bibliographyBackendAutoDetected=
|
||||||
|
bibliographyBackendUserOverride=
|
||||||
|
def_graphic_ext=eps
|
||||||
|
img_extIsRegExp=false
|
||||||
|
img_extensions=.eps .jpg .jpeg .png .pdf .ps .fig .gif
|
||||||
|
kileprversion=3
|
||||||
|
kileversion=2.9.93
|
||||||
|
masterDocument=
|
||||||
|
name=Questions
|
||||||
|
pkg_extIsRegExp=false
|
||||||
|
pkg_extensions=.cls .sty .bbx .cbx .lbx
|
||||||
|
src_extIsRegExp=false
|
||||||
|
src_extensions=.tex .ltx .latex .dtx .ins
|
||||||
|
|
||||||
|
[Tools]
|
||||||
|
MakeIndex=
|
||||||
|
QuickBuild=
|
||||||
|
|
||||||
|
[item:Questions.tex]
|
||||||
|
archive=true
|
||||||
|
encoding=UTF-8
|
||||||
|
highlight=LaTeX
|
||||||
|
mode=LaTeX
|
||||||
|
|
||||||
|
[item:questions.kilepr]
|
||||||
|
archive=true
|
||||||
|
encoding=
|
||||||
|
highlight=
|
||||||
|
mode=
|
Loading…
Reference in New Issue
Block a user