diff options
author | Karl Berry <karl@freefriends.org> | 2014-04-22 21:15:44 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-04-22 21:15:44 +0000 |
commit | 59b1d0358148d12f843891c68805b522f8770e2c (patch) | |
tree | 3bfffa964e1e3a3a0ed49dcf346af4a18f633651 | |
parent | ec9f23829c62091f17731a57aff2ae3e9c274152 (diff) |
lt3graph (22apr14)
git-svn-id: svn://tug.org/texlive/trunk@33623 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Master/texmf-dist/doc/latex/lt3graph/README | 4 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/lt3graph/lt3graph.pdf | bin | 560061 -> 561610 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/lt3graph/lt3graph.tex | 12 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/lt3graph/lt3graph-dry.sty | 2 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/lt3graph/lt3graph.sty | 86 |
5 files changed, 73 insertions, 31 deletions
diff --git a/Master/texmf-dist/doc/latex/lt3graph/README b/Master/texmf-dist/doc/latex/lt3graph/README index 52a25fcaca5..2b7a5504bfa 100644 --- a/Master/texmf-dist/doc/latex/lt3graph/README +++ b/Master/texmf-dist/doc/latex/lt3graph/README @@ -1,9 +1,9 @@ latex-lt3graph ============= -LaTeX Package : lt3graph 0.1.0 +LaTeX Package : lt3graph 0.1.3 -Last Modified : 2014-04-13 +Last Modified : 2014-04-21 Author : Michiel Helvensteijn (www.mhelvens.net) diff --git a/Master/texmf-dist/doc/latex/lt3graph/lt3graph.pdf b/Master/texmf-dist/doc/latex/lt3graph/lt3graph.pdf Binary files differindex 5d3f5922909..b296e7a68ec 100644 --- a/Master/texmf-dist/doc/latex/lt3graph/lt3graph.pdf +++ b/Master/texmf-dist/doc/latex/lt3graph/lt3graph.pdf diff --git a/Master/texmf-dist/doc/latex/lt3graph/lt3graph.tex b/Master/texmf-dist/doc/latex/lt3graph/lt3graph.tex index f3e637870c9..4221d646a9e 100644 --- a/Master/texmf-dist/doc/latex/lt3graph/lt3graph.tex +++ b/Master/texmf-dist/doc/latex/lt3graph/lt3graph.tex @@ -87,6 +87,18 @@ \texttt{\textbackslash graph_(g)put_edge}, which caused their global versions not to work properly} +\changes{0.1.1}{2014/04/14} + {fixed a similar bug in\\ + \texttt{\textbackslash graph_(g)put_edges_from}} + +\changes{0.1.2}{2014/04/14} + {allowing \texttt{\textbackslash graph_map_topological_order_\ldots} + to be nested} + +\changes{0.1.3}{2014/04/21} + {fixed a bug in \texttt{\textbackslash graph_remove_vertex} and + added a \texttt{\textbackslash graph_vertex_count:N} function} + %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \begin{document} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Master/texmf-dist/tex/latex/lt3graph/lt3graph-dry.sty b/Master/texmf-dist/tex/latex/lt3graph/lt3graph-dry.sty index bcb21ea2e3d..388cecaf5ad 100644 --- a/Master/texmf-dist/tex/latex/lt3graph/lt3graph-dry.sty +++ b/Master/texmf-dist/tex/latex/lt3graph/lt3graph-dry.sty @@ -24,7 +24,7 @@ % -- Michiel Helvensteijn \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{dry} +\ProvidesPackage{lt3graph-dry} [2013/10/11 convenience macros for reusing LaTeX code] \RequirePackage{filecontents} diff --git a/Master/texmf-dist/tex/latex/lt3graph/lt3graph.sty b/Master/texmf-dist/tex/latex/lt3graph/lt3graph.sty index 9306e0061bb..2d08948b344 100644 --- a/Master/texmf-dist/tex/latex/lt3graph/lt3graph.sty +++ b/Master/texmf-dist/tex/latex/lt3graph/lt3graph.sty @@ -19,7 +19,7 @@ % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fi %%%% -% \CheckSum{845} +% \CheckSum{870} % % \CharacterTable % {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z @@ -48,7 +48,7 @@ % \begin{macrocode} \NeedsTeXFormat{LaTeX2e} \RequirePackage{expl3} -\ProvidesExplPackage{lt3graph}{2013/12/05}{0.0.9-r2} +\ProvidesExplPackage{lt3graph}{2014/04/21}{0.1.3} {a LaTeX3 datastructure for representing directed graphs with data} % \end{macrocode} % @@ -201,7 +201,7 @@ \cs_new_protected:Nn \__graph_ptr_gnew:Nn { \withargs [\uniquecsname] { \tl_gset:Nn #1 {##1} - \tl_new:c {##1} + \tl_new:c {##1} \tl_gset:cn {##1} {#2} } } @@ -228,6 +228,7 @@ }{ \tl_new:N #1 \tl_set:Nf #1 { \tl_trim_spaces:f {\str_tail:n{#1}} } + \int_new:c {\__graph_tl:nnn{graph}{#1}{vertex-count}} \__graph_for_each_prop_datatype:n { \prop_new:c {\__graph_tl:nnn{graph}{#1}{##1}} } } @@ -343,13 +344,17 @@ { %%% create pointer to value % - \use:c {__graph_ptr_#4new:Nn} \l__graph_vertex_data_tl {#3} + \use:c{__graph_ptr_#4new:Nn} \l__graph_vertex_data_tl {#3} %%% add the vertex % - \use:c {prop_#4put:cnV} {\__graph_tl:nnn{graph}{#1}{vertices}} + \use:c{prop_#4put:cnV} {\__graph_tl:nnn{graph}{#1}{vertices}} {#2} \l__graph_vertex_data_tl + %%% increment the vertex counter + % + \use:c{int_#4incr:c} {\__graph_tl:nnn{graph}{#1}{vertex-count}} + \graph_get_vertex:NnNT #1 {#2} \l_tmpa_tl { %%% initialize degree to 0 % @@ -464,9 +469,13 @@ %%% remove the vertex % - \use{prop_#3remove:cn} {\__graph_tl:nnn{graph}{#1}{vertices}} {#2} - \use{prop_#3remove:cn} {\__graph_tl:nnn{graph}{#1}{indegree}} {#2} - \use{prop_#3remove:cn} {\__graph_tl:nnn{graph}{#1}{outdegree}} {#2} + \use:c{prop_#3remove:cn} {\__graph_tl:nnn{graph}{#1}{vertices}} {#2} + \use:c{prop_#3remove:cn} {\__graph_tl:nnn{graph}{#1}{indegree}} {#2} + \use:c{prop_#3remove:cn} {\__graph_tl:nnn{graph}{#1}{outdegree}} {#2} + + %%% decrement the vertex counter + % + \use:c{int_#3decr:c} {\__graph_tl:nnn{graph}{#1}{vertex-count}} } } \cs_generate_variant:Nn \prop_put:Nnn {cnV} @@ -545,7 +554,7 @@ \graph_map_edges_inline:Nn #2 { \graph_if_vertex_exist:NnT #1 {##1} { \graph_if_vertex_exist:NnT #1 {##2} { - \graph_gput_edge:Nnnn #1 {##1} {##2} {##3} + \use:c{graph_#3put_edge:Nnnn} #1 {##1} {##2} {##3} } } } @@ -809,6 +818,20 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % +% Get the number of vertices in the graph: +% +% \begin{macrocode} +\cs_new:Nn \graph_vertex_count:N { + \int_use:c {\__graph_tl:nnn{graph}{#1}{vertex-count}} +} +% \end{macrocode} +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % Get the number of edges leading out of vertex |#2|: % % \begin{macrocode} @@ -1315,37 +1338,44 @@ %%% Fill \l__graph_source_vertices with source-nodes and count indegrees % - \prop_clear:N \l__graph_source_vertices + \prop_gclear_new:c {l__graph_source_vertices_(\int_use:N\g__graph_nesting_depth_int)_prop} + \prop_gclear_new:c {l__graph_tmp_indeg_(\int_use:N\g__graph_nesting_depth_int)_prop} \graph_map_vertices_inline:Nn #1 { - \prop_put:Nnf \l__graph_tmp_indeg_int {##1} + \prop_put:cnf {l__graph_tmp_indeg_(\int_use:N\g__graph_nesting_depth_int)_prop} {##1} { \graph_get_indegree:Nn #1 {##1} } \int_compare:nT {\graph_get_indegree:Nn #1 {##1} = 0} { - \prop_put:Nnn \l__graph_source_vertices {##1} {} + \prop_put:cnn {l__graph_source_vertices_(\int_use:N\g__graph_nesting_depth_int)_prop} {##1} {} } } %%% Main loop % - \bool_until_do:nn {\prop_if_empty_p:N \l__graph_source_vertices} { + \bool_until_do:nn {\prop_if_empty_p:c {l__graph_source_vertices_(\int_use:N\g__graph_nesting_depth_int)_prop}} { %%% Choose any vertex (\l__graph_topo_key_tl, \l__graph_topo_value_tl) % - \__graph_prop_any_key_pop:NN - \l__graph_source_vertices + \__graph_prop_any_key_pop:cN + {l__graph_source_vertices_(\int_use:N\g__graph_nesting_depth_int)_prop} \l__graph_topo_key_tl \graph_get_vertex:NVNT #1 \l__graph_topo_key_tl \l__graph_topo_val_tl { - %%% Run the mapping funtion on the key and value from that vertex - % - \withargs:VVn \l__graph_topo_key_tl \l__graph_topo_val_tl - { #2 {##1} {##2} } %%% Deduct one from the counter of all affected nodes - %%% and add all now-empty vertices to \l__graph_source_vertices + %%% and add all now-empty vertices to source_vertices % \graph_map_outgoing_edges_inline:NVn #1 \l__graph_topo_key_tl { - \prop_put:Nnf \l__graph_tmp_indeg_int {##2} - {\int_eval:n {\prop_get:Nn \l__graph_tmp_indeg_int {##2} - 1}} - \int_compare:nT {\prop_get:Nn \l__graph_tmp_indeg_int {##2} = 0} { - \prop_put:Nnn \l__graph_source_vertices {##2} {} -} } } } } + \prop_put:cnf {l__graph_tmp_indeg_(\int_use:N\g__graph_nesting_depth_int)_prop} {##2} + {\int_eval:n {\prop_get:cn {l__graph_tmp_indeg_(\int_use:N\g__graph_nesting_depth_int)_prop} {##2} - 1}} + \int_compare:nT {\prop_get:cn {l__graph_tmp_indeg_(\int_use:N\g__graph_nesting_depth_int)_prop} {##2} = 0} { + \prop_put:cnn {l__graph_source_vertices_(\int_use:N\g__graph_nesting_depth_int)_prop} {##2} {} + } } + + %%% Run the mapping funtion on the key and value from that vertex + %%% and manage the nesting depth counter + % + \int_gincr:N \g__graph_nesting_depth_int + \withargs:VVn \l__graph_topo_key_tl \l__graph_topo_val_tl + { #2 {##1} {##2} } + \int_gdecr:N \g__graph_nesting_depth_int + } +} } \cs_new_protected:Nn \__graph_prop_any_key_pop:NN { \prop_map_inline:Nn #1 { \tl_set:Nn #2 {##1} @@ -1354,14 +1384,14 @@ } \tl_set:Nn #2 {\q_no_value} % TODO: test } +\cs_generate_variant:Nn \__graph_prop_any_key_pop:NN {cN} \cs_generate_variant:Nn \withargs:nnn {VVn} \cs_generate_variant:Nn \graph_map_outgoing_edges_inline:Nnn {NVn} -\cs_generate_variant:Nn \prop_put:Nnn {Nnf} +\cs_generate_variant:Nn \prop_put:Nnn {cnf} \cs_generate_variant:Nn \graph_get_vertex:NnNT {NVNT} -\prop_new:N \l__graph_source_vertices -\prop_new:N \l__graph_tmp_indeg_int \tl_new:N \l__graph_topo_key_tl \tl_new:N \l__graph_topo_val_tl +\int_new:N \g__graph_nesting_depth_int % \end{macrocode} % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |