summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/dijkstra/dijkstra.sty
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/dijkstra/dijkstra.sty')
-rw-r--r--macros/latex/contrib/dijkstra/dijkstra.sty336
1 files changed, 187 insertions, 149 deletions
diff --git a/macros/latex/contrib/dijkstra/dijkstra.sty b/macros/latex/contrib/dijkstra/dijkstra.sty
index a1e8872804..b8c673449e 100644
--- a/macros/latex/contrib/dijkstra/dijkstra.sty
+++ b/macros/latex/contrib/dijkstra/dijkstra.sty
@@ -4,15 +4,15 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
\def\dijkname {dijkstra} %
-\def\dijkver {0.11} %
+\def\dijkver {0.12} %
% %
-\def\dijkdate {2017/09/09} %
+\def\dijkdate {2020/06/25} %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% --------------------------------------------------------------------
% This work may be distributed and/or modified under the
-% conditions of the LaTeX Project Public License, either version 1.3
+% conditions of the LaTeX Project Public License, either version 1.3c
% of this license or (at your option) any later version.
% The latest version of this license is in
%
@@ -24,11 +24,10 @@
% This work has the LPPL maintenance status `maintained'.
%
% The Current Maintainer of this work is Christian Tellechea
-% Copyright : Christian Tellechea 2017
+% Copyright : Christian Tellechea 2017-2020
% email: unbonpetit@netc.fr
% Commentaires, suggestions et signalement de bugs bienvenus !
% Comments, bug reports and suggestions are welcome.
-% Copyright: Christian Tellechea 2017
% --------------------------------------------------------------------
% L'extension dijkstra est composée des 4 fichiers suivants :
% - code : dijkstra.sty
@@ -36,6 +35,8 @@
% - fichier lisezmoi : README
% --------------------------------------------------------------------
%
+\csname dijkloadonce\endcsname
+\let\dijkloadonce\endinput
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{dijkstra}[\dijkdate\space v\dijkver\space Dijkstra Algorithm (CT)]
\RequirePackage{simplekv}
@@ -59,6 +60,15 @@
\def\dijk_swapargs#1#2#3{#1{#3}{#2}}
\def\dijk_ifstar#1#2{\def\dijk_ifstar_i{\skv_ifx{*\dijk_nxttok}{\skv_first{#1}}{#2}}\futurelet\dijk_nxttok\dijk_ifstar_i}
\def\dijk_ifopt#1#2{\def\dijk_ifopt_i{\skv_ifx{[\dijk_nxttok}{#1}{#2}}\futurelet\dijk_nxttok\dijk_ifopt_i}
+\def\dijk_stripsp#1%
+{%
+ \long\def\dijk_stripsp##1{\expanded{\dijk_stripsp_i\_marksp##1\__nil\_marksp#1\_marksp\_nil}}%
+ \long\def\dijk_stripsp_i##1\_marksp#1##2\_marksp##3\_nil{\dijk_stripsp_ii##3##1##2\__nil#1\__nil\_nil}%
+ \long\def\dijk_stripsp_ii##1#1\__nil##2\_nil{\dijk_stripsp_iii##1##2\_nil}%
+ \long\def\dijk_stripsp_iii##1##2\__nil##3\_nil{\unexpanded{##2}}%
+}
+\dijk_stripsp{ }
+
\def\dijk_foreach#1\in#2#3%
{%
@@ -73,11 +83,12 @@
{%
\def#1{#2}%
\skv_ifx{\dijk_quark#1}
- {}
- {%
- \skv_ifx{#1\empty}{}{\csname dijk_loopcode_\number\dijk_nest\endcsname}%
- \dijk_foreach_i#1%
- }%
+ {%
+ }
+ {%
+ \skv_ifx{#1\empty}{}{\csname dijk_loopcode_\number\dijk_nest\endcsname}%
+ \dijk_foreach_i#1%
+ }%
}%
\def\dijk_ifinst#1#2%
@@ -99,24 +110,29 @@
\expandafter\readgraph_b\dijk_graph,\dijk_quark[],%
}
-\def\dijk_sanitizegraph#1[#2],%
+\def\dijk_sanitizegraph#1,%
+{%
+ \expandafter\expandafter\expandafter\dijk_sanitizegraph_i\dijk_stripsp{#1},% bugfix 0.12
+}
+
+\def\dijk_sanitizegraph_i#1[#2],%
{%
\skv_ifx{\dijk_quark#1}
- {%
- \dijk_removelastcommainmacro\dijk_graph
- }
- {%
- \skv_eearg{\def\dijk_childnodes}{\skv_removeextremespaces{#1}[}%
- \dijk_foreach\dijk_temp\in{#2}{\expandafter\dijk_sanitizegraph_i\dijk_temp\_nil}%
- \dijk_removelastcommainmacro\dijk_childnodes
- \dijk_eaddtomacro\dijk_graph{\dijk_childnodes],}%
- \dijk_sanitizegraph
- }%
+ {%
+ \dijk_removelastcommainmacro\dijk_graph
+ }
+ {%
+ \skv_eearg{\def\dijk_childnodes}{\dijk_stripsp{#1}[}%
+ \dijk_foreach\dijk_temp\in{#2}{\expandafter\dijk_sanitizegraph_ii\dijk_temp\_nil}%
+ \dijk_removelastcommainmacro\dijk_childnodes
+ \dijk_eaddtomacro\dijk_graph{\dijk_childnodes],}%
+ \dijk_sanitizegraph
+ }%
}
-\def\dijk_sanitizegraph_i#1=#2\_nil
+\def\dijk_sanitizegraph_ii#1=#2\_nil
{%
- \dijk_eeaddtomacro\dijk_childnodes{\skv_removeextremespaces{#1}=}%
+ \dijk_eeaddtomacro\dijk_childnodes{\dijk_stripsp{#1}=}%
\dijk_eaddtomacro\dijk_childnodes{\the\numexpr#2\relax,}%
}
@@ -133,54 +149,55 @@
\def\readgraph_b#1#2[#3]#4,%
{%
\skv_ifx{\dijk_quark#1}
- {%
- \skv_exparg{\dijk_foreach\dijk_tempnodename\in}{\dijk_initlistofnodes}
- {% pour chaque sommet
- \skv_eearg{\dijk_foreach\dijk_tempnodechild\in}{\csname dijknode\dijk_tempnodename\endcsname}
- {% pour chaque enfant
- \expandafter\readgraph_c\dijk_tempnodechild\_nil\dijk_currentnodechildname\dijk_currentnodechilddist% capturer nom et distance de l'enfant
- \dijk_exptwoargs\dijk_ifinst\dijk_initlistofnodes{\dijk_currentnodechildname,}% si l'enfant n'est pas dans la liste des sommets
- {}%
- {%
- \dijk_eaddtomacro\dijk_initlistofnodes{\dijk_currentnodechildname,}% l'y mettre
- \dijk_cscmd\let{dijknode\dijk_currentnodechildname}\empty% et initialiser la liste de ses enfants
- }%
- \unless\ifdijk_oriented% si graphe non orienté, ajouter les distances inverses
- \skv_exparg{\skv_eearg\dijk_ifinst{\csname dijknode\dijk_currentnodechildname\endcsname}}{\dijk_tempnodename=}% si le parent est dans déjà un des enfants de l'enfant
- {%
- \expandafter\def\expandafter\readgraph_d\expandafter########\expandafter1\dijk_tempnodename=########2,########3\_nil{%
- \unless\ifnum########2=\dijk_currentnodechilddist\relax% si distance différente : erreur, c'est pas normal
- \errmessage{Distance "\dijk_tempnodename=########2" incorrecte dans \dijk_currentnodechildname{} comprise comme "\dijk_tempnodename=\dijk_currentnodechilddist"}%
- \dijk_cscmd\edef{dijknode\dijk_currentnodechildname}{########1\dijk_tempnodename=\dijk_currentnodechilddist,########3}%
- \fi
- }%
- \expandafter\expandafter\expandafter\readgraph_d\csname dijknode\dijk_currentnodechildname\endcsname\_nil
- }%
- {% sinon, l'y mettre
- \dijk_cscmd\edef{dijknode\dijk_currentnodechildname}{\dijk_tempnodename=\dijk_currentnodechilddist,\csname dijknode\dijk_currentnodechildname\endcsname}%
- }%
- \fi
- }%
+ {%
+ \skv_exparg{\dijk_foreach\dijk_tempnodename\in}{\dijk_initlistofnodes}
+ {% pour chaque sommet
+ \skv_eearg{\dijk_foreach\dijk_tempnodechild\in}{\csname dijknode\dijk_tempnodename\endcsname}
+ {% pour chaque enfant
+ \expandafter\readgraph_c\dijk_tempnodechild\_nil\dijk_currentnodechildname\dijk_currentnodechilddist% capturer nom et distance de l'enfant
+ \dijk_exptwoargs\dijk_ifinst\dijk_initlistofnodes{\dijk_currentnodechildname,}% si l'enfant n'est pas dans la liste des sommets
+ {%
}%
- \dijk_cnt0
- \skv_exparg{\dijk_foreach\dijk_tempnodename\in}{\dijk_initlistofnodes}
- {% pour chaque sommet, construire la liste de ses enfants
- \advance\dijk_cnt1
- \dijk_cscmd\let{listofchilds_\dijk_tempnodename}\empty
- \skv_eearg{\dijk_foreach\dijk_tempnodechild\in}{\csname dijknode\dijk_tempnodename\endcsname}
- {%
- \expandafter\readgraph_c\dijk_tempnodechild\_nil\dijk_currentnodechildname\dijk_currentnodechilddist
- \expandafter\dijk_eaddtomacro\csname listofchilds_\dijk_tempnodename\endcsname{\dijk_currentnodechildname,}%
- }%
+ {%
+ \dijk_eaddtomacro\dijk_initlistofnodes{\dijk_currentnodechildname,}% l'y mettre
+ \dijk_cscmd\let{dijknode\dijk_currentnodechildname}\empty% et initialiser la liste de ses enfants
}%
- \edef\dijk_numberofnodes{\the\dijk_cnt}%
+ \unless\ifdijk_oriented% si graphe non orienté, ajouter les distances inverses
+ \skv_exparg{\skv_eearg\dijk_ifinst{\csname dijknode\dijk_currentnodechildname\endcsname}}{\dijk_tempnodename=}% si le parent est dans déjà un des enfants de l'enfant
+ {%
+ \expandafter\def\expandafter\readgraph_d\expandafter########\expandafter1\dijk_tempnodename=########2,########3\_nil{%
+ \unless\ifnum########2=\dijk_currentnodechilddist\relax% si distance différente : erreur, c'est pas normal
+ \errmessage{Distance "\dijk_tempnodename=########2" incorrecte dans \dijk_currentnodechildname{} comprise comme "\dijk_tempnodename=\dijk_currentnodechilddist"}%
+ \dijk_cscmd\edef{dijknode\dijk_currentnodechildname}{########1\dijk_tempnodename=\dijk_currentnodechilddist,########3}%
+ \fi
+ }%
+ \expandafter\expandafter\expandafter\readgraph_d\csname dijknode\dijk_currentnodechildname\endcsname\_nil
+ }%
+ {% sinon, l'y mettre
+ \dijk_cscmd\edef{dijknode\dijk_currentnodechildname}{\dijk_tempnodename=\dijk_currentnodechilddist,\csname dijknode\dijk_currentnodechildname\endcsname}%
+ }%
+ \fi
+ }%
}%
- {%
- \def\dijk_currentnodename{#1}%
- \dijk_eaddtomacro\dijk_initlistofnodes{\dijk_currentnodename,}%
- \dijk_cscmd\def{dijknode\dijk_currentnodename}{#3,}%
- \readgraph_b
+ \dijk_cnt0
+ \skv_exparg{\dijk_foreach\dijk_tempnodename\in}{\dijk_initlistofnodes}
+ {% pour chaque sommet, construire la liste de ses enfants
+ \advance\dijk_cnt1
+ \dijk_cscmd\let{listofchilds_\dijk_tempnodename}\empty
+ \skv_eearg{\dijk_foreach\dijk_tempnodechild\in}{\csname dijknode\dijk_tempnodename\endcsname}
+ {%
+ \expandafter\readgraph_c\dijk_tempnodechild\_nil\dijk_currentnodechildname\dijk_currentnodechilddist
+ \expandafter\dijk_eaddtomacro\csname listofchilds_\dijk_tempnodename\endcsname{\dijk_currentnodechildname,}%
+ }%
}%
+ \edef\dijk_numberofnodes{\the\dijk_cnt}%
+ }%
+ {%
+ \def\dijk_currentnodename{#1}%
+ \dijk_eaddtomacro\dijk_initlistofnodes{\dijk_currentnodename,}%
+ \dijk_cscmd\def{dijknode\dijk_currentnodename}{#3,}%
+ \readgraph_b
+ }%
}%
\def\readgraph_c#1=#2\_nil#3#4%
@@ -197,9 +214,12 @@
\def\dijk_removenode#1%
{% enlève le sommet #1 de la liste des sommets non vus
\skv_exparg{\dijk_ifinst}{\expandafter,\dijk_nodestoexplore}{,#1,}
- {\def\dijk_removenode_i##1,#1,##2\_nil{\skv_exparg{\def\dijk_nodestoexplore}{\dijk_gobarg##1,##2}}%
- \expandafter\dijk_removenode_i\expandafter,\dijk_nodestoexplore\_nil}
- {}%
+ {%
+ \def\dijk_removenode_i##1,#1,##2\_nil{\skv_exparg{\def\dijk_nodestoexplore}{\dijk_gobarg##1,##2}}%
+ \expandafter\dijk_removenode_i\expandafter,\dijk_nodestoexplore\_nil
+ }
+ {%
+ }%
}
\def\dijkstra
@@ -213,70 +233,68 @@
\let\dijk_listofnodes\dijk_initlistofnodes
\let\dijk_nodestoexplore\dijk_initlistofnodes
\dijk_cnt0
- \skv_eearg{\def\dijk_currentnode}{\skv_removeextremespaces{#2}}%
- \skv_eearg{\def\dijk_endnode}{\skv_removeextremespaces{#3}}%
- \edef\dijk_tab{%
- \unexpanded\expandafter\expandafter\expandafter{\useKV[\dijkname]{pre-tab}}%
- \noexpand
- \begin{tabular}[\useKV[\dijkname]{v-position}]{%
- *{\dijk_numberofnodes}{|c}|%
+ \skv_eearg{\def\dijk_currentnode}{\dijk_stripsp{#2}}%
+ \skv_eearg{\def\dijk_endnode}{\dijk_stripsp{#3}}%
+ \edef\dijk_tab
+ {%
+ \noexpand\dijk_pre_tab
+ \noexpand\begin{tabular}[\dijk_v_position]{%
+ *{\dijk_numberofnodes}{|\dijk_col_type}|%
\ifboolKV[\dijkname]{show-lastcol}
- {\unexpanded\expandafter\expandafter\expandafter{\useKV[\dijkname]{lastcol-type}}}
+ {\noexpand\dijk_last_col_type}
{}%
}%
\noexpand\hline
- }%
+ }%
\def\dijk_autoamp{\def\dijk_autoamp{\dijk_addtomacro\dijk_tab&}}%
\skv_exparg{\dijk_foreach\dijk_tempnodename\in}\dijk_listofnodes
- {% pour tous le sommets du graphe
- \dijk_autoamp% ajouter "&", sauf la première fois
- \dijk_cscmd\let{dist_\dijk_tempnodename}\dijk_maxint% toutes les distances à +inf
- \dijk_cscmd\let{prev_\dijk_tempnodename}\dijk_quark% tous les prédecesseurs à <quark>
- \dijk_eaddtomacro\dijk_tab{\dijk_tempnodename}% peupler 1re ligne du tableau
- }%
+ {% pour tous le sommets du graphe
+ \dijk_autoamp% ajouter "&", sauf la première fois
+ \dijk_cscmd\let{dist_\dijk_tempnodename}\dijk_maxint% toutes les distances à +inf
+ \dijk_cscmd\let{prev_\dijk_tempnodename}\dijk_quark% tous les prédecesseurs à <quark>
+ \dijk_eaddtomacro\dijk_tab{\dijk_tempnodename}% peupler 1re ligne du tableau
+ }%
\ifboolKV[\dijkname]{show-lastcol}
- {\dijk_eaddtomacro\dijk_tab{\expandafter&\unexpanded\expandafter\expandafter\expandafter{\useKV[\dijkname]{lastcol-label}}}}
+ {\dijk_eaddtomacro\dijk_tab{\expandafter&\dijk_lastcol_label}}
{}%
\dijk_addtomacro\dijk_tab{\\\hline}%
\dijk_cscmd\def{dist_\dijk_currentnode}{0}% distance sommet de départ = 0
\dijk_whilenotempty\dijk_nodestoexplore
+ {%
+ \dijk_findmindist\dijk_currentnode% retourne \dijk_currentnode : le sommet enfant ayant la distance la plus faible
+ \skv_ifx{\dijk_quark\dijk_currentnode}
+ {% si le sommet n'est pas trouvé (graphe non connexe)
+ \global\let\dijkdist\dijk_infinity_code
+ \let\dijk_nodestoexplore\empty% sortir de la boucle
+ }
{%
- \dijk_findmindist\dijk_currentnode% retourne \dijk_currentnode : le sommet enfant ayant la distance la plus faible
- \skv_ifx{\dijk_quark\dijk_currentnode}
- {% si le sommet n'est pas trouvé (graphe non connexe)
- \skv_eearg{\gdef\dijkdist}{\useKV[\dijkname]{infinity-code}}%
- \let\dijk_nodestoexplore\empty% sortir de la boucle
- }
+ \xdef\dijkdist{\csname dist_\dijk_currentnode\endcsname}%
+ \unless\ifx\dijk_nodestoexplore\empty
+ \dijk_addstep
+ \fi
+ \skv_ifx{\dijk_currentnode\dijk_endnode}
+ {% si le sommet de sortie est atteint
+ \let\dijk_nodestoexplore\empty% sortir de la boucle
+ }
+ {% sinon
+ \skv_exparg\dijk_removenode\dijk_currentnode% enlever ce sommet du graphe à explorer
+ \skv_eearg{\dijk_foreach\dijk_temp\in}{\csname listofchilds_\dijk_currentnode\endcsname}
{%
- \xdef\dijkdist{\csname dist_\dijk_currentnode\endcsname}%
- \unless\ifx\dijk_nodestoexplore\empty
- \dijk_addstep
- \fi
- \skv_ifx{\dijk_currentnode\dijk_endnode}
- {% si le sommet de sortie est atteint
- \let\dijk_nodestoexplore\empty% sortir de la boucle
- }
- {% sinon
- \skv_exparg\dijk_removenode\dijk_currentnode% enlever ce sommet du graphe à explorer
- \skv_eearg{\dijk_foreach\dijk_temp\in}{\csname listofchilds_\dijk_currentnode\endcsname}
- {%
- \dijk_exptwoargs\dijk_ifinst\dijk_nodestoexplore{\dijk_temp,}
- {%
- \dijk_exptwoargs\dijk_updatedist\dijk_currentnode\dijk_temp
- }%
- {}%
- }%
- \advance\dijk_cnt1
- }%
+ \dijk_exptwoargs\dijk_ifinst\dijk_nodestoexplore{\dijk_temp,}
+ {\dijk_exptwoargs\dijk_updatedist\dijk_currentnode\dijk_temp}%
+ {}%
}%
+ \advance\dijk_cnt1
+ }%
}%
+ }%
\ifboolKV[\dijkname]{h-rules}
{}
{\dijk_addtomacro\dijk_tab\hline}%
\dijk_addtomacro\dijk_tab{\end{tabular}}%
- \dijk_eeaddtomacro\dijk_tab{\useKV[\dijkname]{post-tab}}%
+ \dijk_eaddtomacro\dijk_tab{\dijk_post_tab}%
\skv_ifx{\dijk_quark\dijk_currentnode}
- {\skv_eearg{\gdef\dijkpath}{\useKV[\dijkname]{nopath-string}}}
+ {\global\let\dijkpath\dijk_nopath_string}
{\skv_exparg\dijk_createpath\dijk_currentnode}% calculer le chemin sauf s'il est impossible à trouver
\ifboolKV[\dijkname]{show-tab}\dijk_tab{}% afficher le tableau
\endgroup
@@ -291,10 +309,12 @@
{% #1=sommet en cours
\skv_eearg{\def\dijk_temp}{\csname prev_#1\endcsname}%
\skv_ifx{\dijk_quark\dijk_temp}
- {}
- {\xdef\dijkpath{\dijk_temp\useKV[\dijkname]{path-sep}\dijkpath}%
+ {%
+ }
+ {%
+ \xdef\dijkpath{\dijk_temp\dijk_path_sep\dijkpath}%
\skv_exparg\dijk_createpathi\dijk_temp
- }%
+ }%
}
\def\dijk_findmindist#1%
@@ -302,12 +322,12 @@
\let\dijk_mindist\dijk_maxint
\let#1\dijk_quark
\skv_exparg{\dijk_foreach\dijk_currentnodechildname\in}\dijk_nodestoexplore
- {%
- \ifnum\csname dist_\dijk_currentnodechildname\endcsname<\dijk_mindist\relax
- \expandafter\let\expandafter\dijk_mindist\csname dist_\dijk_currentnodechildname\endcsname
- \let#1\dijk_currentnodechildname
- \fi
- }%
+ {%
+ \ifnum\csname dist_\dijk_currentnodechildname\endcsname<\dijk_mindist\relax
+ \expandafter\let\expandafter\dijk_mindist\csname dist_\dijk_currentnodechildname\endcsname
+ \let#1\dijk_currentnodechildname
+ \fi
+ }%
}
\def\dijk_whilenotempty#1#2%
@@ -329,35 +349,35 @@
{%
\def\dijk_autoamp{\def\dijk_autoamp{\dijk_addtomacro\dijk_tab&}}%
\skv_exparg{\dijk_foreach\dijk_temp\in}\dijk_listofnodes
+ {%
+ \dijk_autoamp
+ \dijk_exptwoargs\dijk_ifinst\dijk_nodestoexplore\dijk_temp
{%
- \dijk_autoamp
- \dijk_exptwoargs\dijk_ifinst\dijk_nodestoexplore\dijk_temp
- {%
- \ifnum\csname dist_\dijk_temp\endcsname=\dijk_maxint\relax
- \dijk_eeaddtomacro\dijk_tab{\useKV[\dijkname]{infinity-code}}%
- \else
- \skv_ifx{\dijk_temp\dijk_currentnode}% si c'est le sommet fixé, le mettre en valeur
- {%
- \skv_ifcsname{distwithprev_\dijk_temp}
- {%
- \dijk_eeaddtomacro\dijk_tab{\expandafter\expandafter\expandafter\dijk_highlightnode
- \csname distwithprev_\dijk_temp\endcsname}% forme \dijk_highlightnode\formatnodewithprev{<dist>}{<sommet>}
- }
- {%
- \dijk_eeaddtomacro\dijk_tab{\expandafter\expandafter\expandafter
- \highlightfirstnode\expandafter\expandafter\expandafter
- {\csname dist_\dijk_temp\endcsname}}% forme \highlightfirstnode{0}
- }%
- }
- {% sinon, afficher normalement (forme \formatnodewithprev{<dist>}{<sommet>})
- \dijk_eeaddtomacro\dijk_tab{\csname dist\ifcsname distwithprev_\dijk_temp\endcsname withprev\fi _\dijk_temp\endcsname}%
- }%
- \fi
- }%
+ \ifnum\csname dist_\dijk_temp\endcsname=\dijk_maxint\relax
+ \dijk_eaddtomacro\dijk_tab{\dijk_infinity_code}%
+ \else
+ \skv_ifx{\dijk_temp\dijk_currentnode}% si c'est le sommet fixé, le mettre en valeur
{%
- \dijk_eeaddtomacro\dijk_tab{\useKV[\dijkname]{norevisit-code}}% sommet déjà fixé
+ \skv_ifcsname{distwithprev_\dijk_temp}
+ {%
+ \dijk_eeaddtomacro\dijk_tab{\expandafter\expandafter\expandafter\dijk_highlightnode
+ \csname distwithprev_\dijk_temp\endcsname}% forme \dijk_highlightnode\formatnodewithprev{<dist>}{<sommet>}
+ }
+ {%
+ \dijk_eeaddtomacro\dijk_tab{\expandafter\expandafter\expandafter
+ \highlightfirstnode\expandafter\expandafter\expandafter
+ {\csname dist_\dijk_temp\endcsname}}% forme \highlightfirstnode{0}
+ }%
+ }
+ {% sinon, afficher normalement (forme \formatnodewithprev{<dist>}{<sommet>})
+ \dijk_eeaddtomacro\dijk_tab{\csname dist\ifcsname distwithprev_\dijk_temp\endcsname withprev\fi _\dijk_temp\endcsname}%
}%
+ \fi
+ }%
+ {%
+ \dijk_eaddtomacro\dijk_tab{\dijk_no_revisit_code}% sommet déjà fixé
}%
+ }%
\ifboolKV[\dijkname]{show-lastcol}
{\dijk_eaddtomacro\dijk_tab{\expandafter&\detokenize\expandafter{\dijk_currentnode}}}% ajout du sommet fixé
{}%
@@ -369,9 +389,22 @@
\def\dijk_highlightnode\formatnodewithprev{\highlightnode}
+\defKV[\dijkname]{%
+ v-position = \def\dijk_v_position {#1},
+ pre-tab = \def\dijk_pre_tab {#1},
+ post-tab = \def\dijk_post_tab {#1},
+ col-type = \def\dijk_col_type {#1},
+ infinity-code = \def\dijk_infinity_code {#1},
+ norevisit-code = \def\dijk_no_revisit_code{#1},
+ lastcol-type = \def\dijk_last_col_type {#1},
+ lastcol-label = \def\dijk_lastcol_label {#1},
+ nopath-string = \def\dijk_nopath_string {#1},
+ path-sep = \def\dijk_path_sep {#1}
+}
+
\dijk_restorecatcode
-\expandafter\let\expandafter\initdijk\csname skv_[\dijkname]\endcsname
+\def\initdijk{\restoreKV[\dijkname]}
% Macros permettant de modifier les <valeurs> des <clés>
\def\setdijk#{\setKV[\dijkname]}
@@ -421,4 +454,9 @@ Versions :
| 0.11 | 09/09/2017 | - retrait d'un \show, laissé par oubli après les |
| | | phases de débogage |
| | | - petit nettoyage du code |
+|---------+------------+------------------------------------------------------|
+| 0.12 | 25/06/2020 | - bugfix : le package est rendu compatible avec la |
+| | | version 0.2 de simplekv |
+| | | - bugfix : mauvaise gestion est espaces dans la macro|
+| | | \dijk_sanitizegraph |
|---------+------------+------------------------------------------------------| \ No newline at end of file