Show parallelism of Algorithm











up vote
3
down vote

favorite












I want to show that a certain part in a algorithm is working parallel.
So I thought about something like a big bracket around the lineS/state in my algorithm.



In the following picture I added the bracket with Photoshop:



enter image description here



Is there a way to this with the algorithm/algorithmic package in Latex?



Source-Code:



begin{algorithm}
caption{Parallele Tourkonstruktion}
label{ParallelTour}
textbf{Eingabe:} Datenobjekt mit $v$ Städten sowie einer Distanzmatrix $D$ und Pheromonmatrix $S$, texttt{vector} $M$ mit $m$ Ameisen
\textbf{Ausgabe:} Route $r$ mit der kürzesten gefunden Distanz $d_s$
begin{algorithmic}[1]
State $j := 0$
While{$j < v$}
For{textbf{each} Ameise $m_i in M$}
State Starte in einer zufälligen Stadt $v_0$
State Ermittle die nächste Stadt $v_i$ und gehe dorthin
State $r_{m_i} := v_i$
State $d_m := d_m + D_{i-1,i}$
State Aktualisiere Pheromonmatrix $S$
EndFor
State $j := j + 1$
EndWhile
State $d_s = infty$
For{textbf{each} Ameise $m_i in M$}
If{Tourlänge $d_m < d_s$}
State $d_s := d_m$
EndIf
EndFor
end{algorithmic}
end{algorithm}









share|improve this question









New contributor




Samy Dressel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Welcome to TeX.SX! Can you please add the source code for the picture, so not to have to rekey it?
    – egreg
    2 hours ago










  • Thanks - I added the source code :)
    – Samy Dressel
    2 hours ago















up vote
3
down vote

favorite












I want to show that a certain part in a algorithm is working parallel.
So I thought about something like a big bracket around the lineS/state in my algorithm.



In the following picture I added the bracket with Photoshop:



enter image description here



Is there a way to this with the algorithm/algorithmic package in Latex?



Source-Code:



begin{algorithm}
caption{Parallele Tourkonstruktion}
label{ParallelTour}
textbf{Eingabe:} Datenobjekt mit $v$ Städten sowie einer Distanzmatrix $D$ und Pheromonmatrix $S$, texttt{vector} $M$ mit $m$ Ameisen
\textbf{Ausgabe:} Route $r$ mit der kürzesten gefunden Distanz $d_s$
begin{algorithmic}[1]
State $j := 0$
While{$j < v$}
For{textbf{each} Ameise $m_i in M$}
State Starte in einer zufälligen Stadt $v_0$
State Ermittle die nächste Stadt $v_i$ und gehe dorthin
State $r_{m_i} := v_i$
State $d_m := d_m + D_{i-1,i}$
State Aktualisiere Pheromonmatrix $S$
EndFor
State $j := j + 1$
EndWhile
State $d_s = infty$
For{textbf{each} Ameise $m_i in M$}
If{Tourlänge $d_m < d_s$}
State $d_s := d_m$
EndIf
EndFor
end{algorithmic}
end{algorithm}









share|improve this question









New contributor




Samy Dressel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • Welcome to TeX.SX! Can you please add the source code for the picture, so not to have to rekey it?
    – egreg
    2 hours ago










  • Thanks - I added the source code :)
    – Samy Dressel
    2 hours ago













up vote
3
down vote

favorite









up vote
3
down vote

favorite











I want to show that a certain part in a algorithm is working parallel.
So I thought about something like a big bracket around the lineS/state in my algorithm.



In the following picture I added the bracket with Photoshop:



enter image description here



Is there a way to this with the algorithm/algorithmic package in Latex?



Source-Code:



begin{algorithm}
caption{Parallele Tourkonstruktion}
label{ParallelTour}
textbf{Eingabe:} Datenobjekt mit $v$ Städten sowie einer Distanzmatrix $D$ und Pheromonmatrix $S$, texttt{vector} $M$ mit $m$ Ameisen
\textbf{Ausgabe:} Route $r$ mit der kürzesten gefunden Distanz $d_s$
begin{algorithmic}[1]
State $j := 0$
While{$j < v$}
For{textbf{each} Ameise $m_i in M$}
State Starte in einer zufälligen Stadt $v_0$
State Ermittle die nächste Stadt $v_i$ und gehe dorthin
State $r_{m_i} := v_i$
State $d_m := d_m + D_{i-1,i}$
State Aktualisiere Pheromonmatrix $S$
EndFor
State $j := j + 1$
EndWhile
State $d_s = infty$
For{textbf{each} Ameise $m_i in M$}
If{Tourlänge $d_m < d_s$}
State $d_s := d_m$
EndIf
EndFor
end{algorithmic}
end{algorithm}









share|improve this question









New contributor




Samy Dressel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I want to show that a certain part in a algorithm is working parallel.
So I thought about something like a big bracket around the lineS/state in my algorithm.



In the following picture I added the bracket with Photoshop:



enter image description here



Is there a way to this with the algorithm/algorithmic package in Latex?



Source-Code:



begin{algorithm}
caption{Parallele Tourkonstruktion}
label{ParallelTour}
textbf{Eingabe:} Datenobjekt mit $v$ Städten sowie einer Distanzmatrix $D$ und Pheromonmatrix $S$, texttt{vector} $M$ mit $m$ Ameisen
\textbf{Ausgabe:} Route $r$ mit der kürzesten gefunden Distanz $d_s$
begin{algorithmic}[1]
State $j := 0$
While{$j < v$}
For{textbf{each} Ameise $m_i in M$}
State Starte in einer zufälligen Stadt $v_0$
State Ermittle die nächste Stadt $v_i$ und gehe dorthin
State $r_{m_i} := v_i$
State $d_m := d_m + D_{i-1,i}$
State Aktualisiere Pheromonmatrix $S$
EndFor
State $j := j + 1$
EndWhile
State $d_s = infty$
For{textbf{each} Ameise $m_i in M$}
If{Tourlänge $d_m < d_s$}
State $d_s := d_m$
EndIf
EndFor
end{algorithmic}
end{algorithm}






algorithms






share|improve this question









New contributor




Samy Dressel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Samy Dressel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 2 hours ago





















New contributor




Samy Dressel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 2 hours ago









Samy Dressel

185




185




New contributor




Samy Dressel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Samy Dressel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Samy Dressel is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • Welcome to TeX.SX! Can you please add the source code for the picture, so not to have to rekey it?
    – egreg
    2 hours ago










  • Thanks - I added the source code :)
    – Samy Dressel
    2 hours ago


















  • Welcome to TeX.SX! Can you please add the source code for the picture, so not to have to rekey it?
    – egreg
    2 hours ago










  • Thanks - I added the source code :)
    – Samy Dressel
    2 hours ago
















Welcome to TeX.SX! Can you please add the source code for the picture, so not to have to rekey it?
– egreg
2 hours ago




Welcome to TeX.SX! Can you please add the source code for the picture, so not to have to rekey it?
– egreg
2 hours ago












Thanks - I added the source code :)
– Samy Dressel
2 hours ago




Thanks - I added the source code :)
– Samy Dressel
2 hours ago










2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










You can set a smashed math construction to span the five rows within the for each:



enter image description here



documentclass{article}

usepackage{algorithm,mathtools}
usepackage[noend]{algpseudocode}
usepackage[utf8]{inputenc}

newcommand{isassigned}{vcentcolon=}

begin{document}

begin{algorithm}
caption{Parallele Tourkonstruktion}
textbf{Eingabe:} Datenobjekt mit $v$ Städten sowie einer Distanzmatrix $D$
und Pheromonmatrix $S$, texttt{vector} $M$ mit $m$ Ameisen \
textbf{Ausgabe:} Route $r$ mit der kürzesten gefunden Distanz $d_s$
begin{algorithmic}[1]
State $j isassigned 0$
While{$j < v$}
For{textbf{each} Ameise $m_i in M$}
State Starte in einer zufälligen Stadt $v_0$
State Ermittle die nächste Stadt $v_i$ und gehe dorthin
State $r_{m_i} isassigned v_i$
hspace{17em}smash{$left.rule{0pt}{2.7baselineskip}right} mbox{in parallel}$}
State $d_m isassigned d_m + D_{i-1,i}$
State Aktualisiere Pheromonmatrix $S$
EndFor
State $j isassigned j + 1$
EndWhile
State $d_s = infty$
For{textbf{each} Ameise $m_i in M$}
If{Tourlänge $d_m < d_s$}
State $d_s isassigned d_m$
EndIf
EndFor
end{algorithmic}
end{algorithm}

end{document}


If you want the construction to cover the for each as well, then you can use



% ...
For{textbf{each} Ameise $m_i in M$}
State Starte in einer zufälligen Stadt $v_0$
State Ermittle die nächste Stadt $v_i$ und gehe dorthin
State $r_{m_i} isassigned v_i$
hspace{17em}raisebox{.5baselineskip}[0pt][0pt]{$left.rule{0pt}{3.2baselineskip}right} mbox{in parallel}$}
State $d_m isassigned d_m + D_{i-1,i}$
State Aktualisiere Pheromonmatrix $S$
EndFor
% ...


enter image description here






share|improve this answer




























    up vote
    2
    down vote













    Here is a quick tikzmark alternative.



    documentclass{article}
    usepackage{algorithm}
    usepackage[noend]{algpseudocode}
    usepackage{tikz}
    usetikzlibrary{tikzmark,decorations.pathreplacing}

    begin{document}

    begin{algorithm}
    caption{Parallele Tourkonstruktion}
    textbf{Eingabe:} Datenobjekt mit $v$ St"adten sowie einer Distanzmatrix $D$
    und Pheromonmatrix $S$, texttt{vector} $M$ mit $m$ Ameisen \
    textbf{Ausgabe:} Route $r$ mit der k"urzesten gefunden Distanz $d_s$
    begin{algorithmic}[1]
    State $j < 0$
    While{$j < v$}
    For{textbf{each} Ameise $m_i in M$}
    State Starte in einer zuf"alligen Stadt tikzmarknode{v0}{$v_0$}
    State Ermittle die n"achste Stadt $v_i$ und gehe tikzmarknode{dorthin}{dorthin}
    State $r_{m_i} < v_i$
    %hspace{17em}smash{$left.rule{0pt}{2.7baselineskip}right} mbox{in parallel}$}
    State $d_m < d_m + D_{i-1,i}$
    State Aktualisiere Pheromonmatrix tikzmarknode{S}{$S$}
    EndFor
    State $j < j + 1$
    EndWhile
    State $d_s = infty$
    For{textbf{each} Ameise $m_i in M$}
    If{Tourl"ange $d_m < d_s$}
    State $d_s < d_m$
    EndIf
    EndFor
    end{algorithmic}
    end{algorithm}
    begin{tikzpicture}[overlay,remember picture]
    draw[thick,decorate,decoration=brace] ([xshift=1mm,yshift=2mm]dorthin.east |- v0.north)
    -- ([xshift=1mm,yshift=-2mm]dorthin.east |- S.south)
    node[midway,right,align=left]{Working Parallel};
    end{tikzpicture}

    end{document}


    enter image description here



    Let me mention that tikzmark can do much more. It can annotate code without putting any commands in, i.e. you can really embed working code and annotate it. Yet this is not required here.






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "85"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });






      Samy Dressel is a new contributor. Be nice, and check out our Code of Conduct.










       

      draft saved


      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461499%2fshow-parallelism-of-algorithm%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote



      accepted










      You can set a smashed math construction to span the five rows within the for each:



      enter image description here



      documentclass{article}

      usepackage{algorithm,mathtools}
      usepackage[noend]{algpseudocode}
      usepackage[utf8]{inputenc}

      newcommand{isassigned}{vcentcolon=}

      begin{document}

      begin{algorithm}
      caption{Parallele Tourkonstruktion}
      textbf{Eingabe:} Datenobjekt mit $v$ Städten sowie einer Distanzmatrix $D$
      und Pheromonmatrix $S$, texttt{vector} $M$ mit $m$ Ameisen \
      textbf{Ausgabe:} Route $r$ mit der kürzesten gefunden Distanz $d_s$
      begin{algorithmic}[1]
      State $j isassigned 0$
      While{$j < v$}
      For{textbf{each} Ameise $m_i in M$}
      State Starte in einer zufälligen Stadt $v_0$
      State Ermittle die nächste Stadt $v_i$ und gehe dorthin
      State $r_{m_i} isassigned v_i$
      hspace{17em}smash{$left.rule{0pt}{2.7baselineskip}right} mbox{in parallel}$}
      State $d_m isassigned d_m + D_{i-1,i}$
      State Aktualisiere Pheromonmatrix $S$
      EndFor
      State $j isassigned j + 1$
      EndWhile
      State $d_s = infty$
      For{textbf{each} Ameise $m_i in M$}
      If{Tourlänge $d_m < d_s$}
      State $d_s isassigned d_m$
      EndIf
      EndFor
      end{algorithmic}
      end{algorithm}

      end{document}


      If you want the construction to cover the for each as well, then you can use



      % ...
      For{textbf{each} Ameise $m_i in M$}
      State Starte in einer zufälligen Stadt $v_0$
      State Ermittle die nächste Stadt $v_i$ und gehe dorthin
      State $r_{m_i} isassigned v_i$
      hspace{17em}raisebox{.5baselineskip}[0pt][0pt]{$left.rule{0pt}{3.2baselineskip}right} mbox{in parallel}$}
      State $d_m isassigned d_m + D_{i-1,i}$
      State Aktualisiere Pheromonmatrix $S$
      EndFor
      % ...


      enter image description here






      share|improve this answer

























        up vote
        2
        down vote



        accepted










        You can set a smashed math construction to span the five rows within the for each:



        enter image description here



        documentclass{article}

        usepackage{algorithm,mathtools}
        usepackage[noend]{algpseudocode}
        usepackage[utf8]{inputenc}

        newcommand{isassigned}{vcentcolon=}

        begin{document}

        begin{algorithm}
        caption{Parallele Tourkonstruktion}
        textbf{Eingabe:} Datenobjekt mit $v$ Städten sowie einer Distanzmatrix $D$
        und Pheromonmatrix $S$, texttt{vector} $M$ mit $m$ Ameisen \
        textbf{Ausgabe:} Route $r$ mit der kürzesten gefunden Distanz $d_s$
        begin{algorithmic}[1]
        State $j isassigned 0$
        While{$j < v$}
        For{textbf{each} Ameise $m_i in M$}
        State Starte in einer zufälligen Stadt $v_0$
        State Ermittle die nächste Stadt $v_i$ und gehe dorthin
        State $r_{m_i} isassigned v_i$
        hspace{17em}smash{$left.rule{0pt}{2.7baselineskip}right} mbox{in parallel}$}
        State $d_m isassigned d_m + D_{i-1,i}$
        State Aktualisiere Pheromonmatrix $S$
        EndFor
        State $j isassigned j + 1$
        EndWhile
        State $d_s = infty$
        For{textbf{each} Ameise $m_i in M$}
        If{Tourlänge $d_m < d_s$}
        State $d_s isassigned d_m$
        EndIf
        EndFor
        end{algorithmic}
        end{algorithm}

        end{document}


        If you want the construction to cover the for each as well, then you can use



        % ...
        For{textbf{each} Ameise $m_i in M$}
        State Starte in einer zufälligen Stadt $v_0$
        State Ermittle die nächste Stadt $v_i$ und gehe dorthin
        State $r_{m_i} isassigned v_i$
        hspace{17em}raisebox{.5baselineskip}[0pt][0pt]{$left.rule{0pt}{3.2baselineskip}right} mbox{in parallel}$}
        State $d_m isassigned d_m + D_{i-1,i}$
        State Aktualisiere Pheromonmatrix $S$
        EndFor
        % ...


        enter image description here






        share|improve this answer























          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          You can set a smashed math construction to span the five rows within the for each:



          enter image description here



          documentclass{article}

          usepackage{algorithm,mathtools}
          usepackage[noend]{algpseudocode}
          usepackage[utf8]{inputenc}

          newcommand{isassigned}{vcentcolon=}

          begin{document}

          begin{algorithm}
          caption{Parallele Tourkonstruktion}
          textbf{Eingabe:} Datenobjekt mit $v$ Städten sowie einer Distanzmatrix $D$
          und Pheromonmatrix $S$, texttt{vector} $M$ mit $m$ Ameisen \
          textbf{Ausgabe:} Route $r$ mit der kürzesten gefunden Distanz $d_s$
          begin{algorithmic}[1]
          State $j isassigned 0$
          While{$j < v$}
          For{textbf{each} Ameise $m_i in M$}
          State Starte in einer zufälligen Stadt $v_0$
          State Ermittle die nächste Stadt $v_i$ und gehe dorthin
          State $r_{m_i} isassigned v_i$
          hspace{17em}smash{$left.rule{0pt}{2.7baselineskip}right} mbox{in parallel}$}
          State $d_m isassigned d_m + D_{i-1,i}$
          State Aktualisiere Pheromonmatrix $S$
          EndFor
          State $j isassigned j + 1$
          EndWhile
          State $d_s = infty$
          For{textbf{each} Ameise $m_i in M$}
          If{Tourlänge $d_m < d_s$}
          State $d_s isassigned d_m$
          EndIf
          EndFor
          end{algorithmic}
          end{algorithm}

          end{document}


          If you want the construction to cover the for each as well, then you can use



          % ...
          For{textbf{each} Ameise $m_i in M$}
          State Starte in einer zufälligen Stadt $v_0$
          State Ermittle die nächste Stadt $v_i$ und gehe dorthin
          State $r_{m_i} isassigned v_i$
          hspace{17em}raisebox{.5baselineskip}[0pt][0pt]{$left.rule{0pt}{3.2baselineskip}right} mbox{in parallel}$}
          State $d_m isassigned d_m + D_{i-1,i}$
          State Aktualisiere Pheromonmatrix $S$
          EndFor
          % ...


          enter image description here






          share|improve this answer












          You can set a smashed math construction to span the five rows within the for each:



          enter image description here



          documentclass{article}

          usepackage{algorithm,mathtools}
          usepackage[noend]{algpseudocode}
          usepackage[utf8]{inputenc}

          newcommand{isassigned}{vcentcolon=}

          begin{document}

          begin{algorithm}
          caption{Parallele Tourkonstruktion}
          textbf{Eingabe:} Datenobjekt mit $v$ Städten sowie einer Distanzmatrix $D$
          und Pheromonmatrix $S$, texttt{vector} $M$ mit $m$ Ameisen \
          textbf{Ausgabe:} Route $r$ mit der kürzesten gefunden Distanz $d_s$
          begin{algorithmic}[1]
          State $j isassigned 0$
          While{$j < v$}
          For{textbf{each} Ameise $m_i in M$}
          State Starte in einer zufälligen Stadt $v_0$
          State Ermittle die nächste Stadt $v_i$ und gehe dorthin
          State $r_{m_i} isassigned v_i$
          hspace{17em}smash{$left.rule{0pt}{2.7baselineskip}right} mbox{in parallel}$}
          State $d_m isassigned d_m + D_{i-1,i}$
          State Aktualisiere Pheromonmatrix $S$
          EndFor
          State $j isassigned j + 1$
          EndWhile
          State $d_s = infty$
          For{textbf{each} Ameise $m_i in M$}
          If{Tourlänge $d_m < d_s$}
          State $d_s isassigned d_m$
          EndIf
          EndFor
          end{algorithmic}
          end{algorithm}

          end{document}


          If you want the construction to cover the for each as well, then you can use



          % ...
          For{textbf{each} Ameise $m_i in M$}
          State Starte in einer zufälligen Stadt $v_0$
          State Ermittle die nächste Stadt $v_i$ und gehe dorthin
          State $r_{m_i} isassigned v_i$
          hspace{17em}raisebox{.5baselineskip}[0pt][0pt]{$left.rule{0pt}{3.2baselineskip}right} mbox{in parallel}$}
          State $d_m isassigned d_m + D_{i-1,i}$
          State Aktualisiere Pheromonmatrix $S$
          EndFor
          % ...


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 1 hour ago









          Werner

          431k599491627




          431k599491627






















              up vote
              2
              down vote













              Here is a quick tikzmark alternative.



              documentclass{article}
              usepackage{algorithm}
              usepackage[noend]{algpseudocode}
              usepackage{tikz}
              usetikzlibrary{tikzmark,decorations.pathreplacing}

              begin{document}

              begin{algorithm}
              caption{Parallele Tourkonstruktion}
              textbf{Eingabe:} Datenobjekt mit $v$ St"adten sowie einer Distanzmatrix $D$
              und Pheromonmatrix $S$, texttt{vector} $M$ mit $m$ Ameisen \
              textbf{Ausgabe:} Route $r$ mit der k"urzesten gefunden Distanz $d_s$
              begin{algorithmic}[1]
              State $j < 0$
              While{$j < v$}
              For{textbf{each} Ameise $m_i in M$}
              State Starte in einer zuf"alligen Stadt tikzmarknode{v0}{$v_0$}
              State Ermittle die n"achste Stadt $v_i$ und gehe tikzmarknode{dorthin}{dorthin}
              State $r_{m_i} < v_i$
              %hspace{17em}smash{$left.rule{0pt}{2.7baselineskip}right} mbox{in parallel}$}
              State $d_m < d_m + D_{i-1,i}$
              State Aktualisiere Pheromonmatrix tikzmarknode{S}{$S$}
              EndFor
              State $j < j + 1$
              EndWhile
              State $d_s = infty$
              For{textbf{each} Ameise $m_i in M$}
              If{Tourl"ange $d_m < d_s$}
              State $d_s < d_m$
              EndIf
              EndFor
              end{algorithmic}
              end{algorithm}
              begin{tikzpicture}[overlay,remember picture]
              draw[thick,decorate,decoration=brace] ([xshift=1mm,yshift=2mm]dorthin.east |- v0.north)
              -- ([xshift=1mm,yshift=-2mm]dorthin.east |- S.south)
              node[midway,right,align=left]{Working Parallel};
              end{tikzpicture}

              end{document}


              enter image description here



              Let me mention that tikzmark can do much more. It can annotate code without putting any commands in, i.e. you can really embed working code and annotate it. Yet this is not required here.






              share|improve this answer

























                up vote
                2
                down vote













                Here is a quick tikzmark alternative.



                documentclass{article}
                usepackage{algorithm}
                usepackage[noend]{algpseudocode}
                usepackage{tikz}
                usetikzlibrary{tikzmark,decorations.pathreplacing}

                begin{document}

                begin{algorithm}
                caption{Parallele Tourkonstruktion}
                textbf{Eingabe:} Datenobjekt mit $v$ St"adten sowie einer Distanzmatrix $D$
                und Pheromonmatrix $S$, texttt{vector} $M$ mit $m$ Ameisen \
                textbf{Ausgabe:} Route $r$ mit der k"urzesten gefunden Distanz $d_s$
                begin{algorithmic}[1]
                State $j < 0$
                While{$j < v$}
                For{textbf{each} Ameise $m_i in M$}
                State Starte in einer zuf"alligen Stadt tikzmarknode{v0}{$v_0$}
                State Ermittle die n"achste Stadt $v_i$ und gehe tikzmarknode{dorthin}{dorthin}
                State $r_{m_i} < v_i$
                %hspace{17em}smash{$left.rule{0pt}{2.7baselineskip}right} mbox{in parallel}$}
                State $d_m < d_m + D_{i-1,i}$
                State Aktualisiere Pheromonmatrix tikzmarknode{S}{$S$}
                EndFor
                State $j < j + 1$
                EndWhile
                State $d_s = infty$
                For{textbf{each} Ameise $m_i in M$}
                If{Tourl"ange $d_m < d_s$}
                State $d_s < d_m$
                EndIf
                EndFor
                end{algorithmic}
                end{algorithm}
                begin{tikzpicture}[overlay,remember picture]
                draw[thick,decorate,decoration=brace] ([xshift=1mm,yshift=2mm]dorthin.east |- v0.north)
                -- ([xshift=1mm,yshift=-2mm]dorthin.east |- S.south)
                node[midway,right,align=left]{Working Parallel};
                end{tikzpicture}

                end{document}


                enter image description here



                Let me mention that tikzmark can do much more. It can annotate code without putting any commands in, i.e. you can really embed working code and annotate it. Yet this is not required here.






                share|improve this answer























                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote









                  Here is a quick tikzmark alternative.



                  documentclass{article}
                  usepackage{algorithm}
                  usepackage[noend]{algpseudocode}
                  usepackage{tikz}
                  usetikzlibrary{tikzmark,decorations.pathreplacing}

                  begin{document}

                  begin{algorithm}
                  caption{Parallele Tourkonstruktion}
                  textbf{Eingabe:} Datenobjekt mit $v$ St"adten sowie einer Distanzmatrix $D$
                  und Pheromonmatrix $S$, texttt{vector} $M$ mit $m$ Ameisen \
                  textbf{Ausgabe:} Route $r$ mit der k"urzesten gefunden Distanz $d_s$
                  begin{algorithmic}[1]
                  State $j < 0$
                  While{$j < v$}
                  For{textbf{each} Ameise $m_i in M$}
                  State Starte in einer zuf"alligen Stadt tikzmarknode{v0}{$v_0$}
                  State Ermittle die n"achste Stadt $v_i$ und gehe tikzmarknode{dorthin}{dorthin}
                  State $r_{m_i} < v_i$
                  %hspace{17em}smash{$left.rule{0pt}{2.7baselineskip}right} mbox{in parallel}$}
                  State $d_m < d_m + D_{i-1,i}$
                  State Aktualisiere Pheromonmatrix tikzmarknode{S}{$S$}
                  EndFor
                  State $j < j + 1$
                  EndWhile
                  State $d_s = infty$
                  For{textbf{each} Ameise $m_i in M$}
                  If{Tourl"ange $d_m < d_s$}
                  State $d_s < d_m$
                  EndIf
                  EndFor
                  end{algorithmic}
                  end{algorithm}
                  begin{tikzpicture}[overlay,remember picture]
                  draw[thick,decorate,decoration=brace] ([xshift=1mm,yshift=2mm]dorthin.east |- v0.north)
                  -- ([xshift=1mm,yshift=-2mm]dorthin.east |- S.south)
                  node[midway,right,align=left]{Working Parallel};
                  end{tikzpicture}

                  end{document}


                  enter image description here



                  Let me mention that tikzmark can do much more. It can annotate code without putting any commands in, i.e. you can really embed working code and annotate it. Yet this is not required here.






                  share|improve this answer












                  Here is a quick tikzmark alternative.



                  documentclass{article}
                  usepackage{algorithm}
                  usepackage[noend]{algpseudocode}
                  usepackage{tikz}
                  usetikzlibrary{tikzmark,decorations.pathreplacing}

                  begin{document}

                  begin{algorithm}
                  caption{Parallele Tourkonstruktion}
                  textbf{Eingabe:} Datenobjekt mit $v$ St"adten sowie einer Distanzmatrix $D$
                  und Pheromonmatrix $S$, texttt{vector} $M$ mit $m$ Ameisen \
                  textbf{Ausgabe:} Route $r$ mit der k"urzesten gefunden Distanz $d_s$
                  begin{algorithmic}[1]
                  State $j < 0$
                  While{$j < v$}
                  For{textbf{each} Ameise $m_i in M$}
                  State Starte in einer zuf"alligen Stadt tikzmarknode{v0}{$v_0$}
                  State Ermittle die n"achste Stadt $v_i$ und gehe tikzmarknode{dorthin}{dorthin}
                  State $r_{m_i} < v_i$
                  %hspace{17em}smash{$left.rule{0pt}{2.7baselineskip}right} mbox{in parallel}$}
                  State $d_m < d_m + D_{i-1,i}$
                  State Aktualisiere Pheromonmatrix tikzmarknode{S}{$S$}
                  EndFor
                  State $j < j + 1$
                  EndWhile
                  State $d_s = infty$
                  For{textbf{each} Ameise $m_i in M$}
                  If{Tourl"ange $d_m < d_s$}
                  State $d_s < d_m$
                  EndIf
                  EndFor
                  end{algorithmic}
                  end{algorithm}
                  begin{tikzpicture}[overlay,remember picture]
                  draw[thick,decorate,decoration=brace] ([xshift=1mm,yshift=2mm]dorthin.east |- v0.north)
                  -- ([xshift=1mm,yshift=-2mm]dorthin.east |- S.south)
                  node[midway,right,align=left]{Working Parallel};
                  end{tikzpicture}

                  end{document}


                  enter image description here



                  Let me mention that tikzmark can do much more. It can annotate code without putting any commands in, i.e. you can really embed working code and annotate it. Yet this is not required here.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 1 hour ago









                  marmot

                  77.5k487164




                  77.5k487164






















                      Samy Dressel is a new contributor. Be nice, and check out our Code of Conduct.










                       

                      draft saved


                      draft discarded


















                      Samy Dressel is a new contributor. Be nice, and check out our Code of Conduct.













                      Samy Dressel is a new contributor. Be nice, and check out our Code of Conduct.












                      Samy Dressel is a new contributor. Be nice, and check out our Code of Conduct.















                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f461499%2fshow-parallelism-of-algorithm%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      404 Error Contact Form 7 ajax form submitting

                      How to know if a Active Directory user can login interactively

                      Refactoring coordinates for Minecraft Pi buildings written in Python