Help for this page

Select Code to Download


  1. or download this
    #Prims algorithm to calculate MST of $G
    sub prims{
        my($G, $root, $output) = @_;
    ...
        print {$output} "MST = {@MST} \n";
        return $MST;
    }    
    
  2. or download this
    our @preorder_memoized;
    sub preorder_tree_walk{
        my ($G, $root, $output) = @_;
    ...
             preorder_tree_walk($G, $edge, $output);         
             }
    }