Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Finding Hamiltonian Paths using the Regexp Engine

by BrowserUk (Pope)
on Aug 08, 2003 at 08:45 UTC ( #282139=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    (?:(?{local $q [0] = $nodes [0]})|
       (?{local $q [0] = $nodes [1]})|
    ...
         $q [7] eq $q [6] ||
         !$graph {$q [6]} {$q [7]}})x|)
    (?{ @path = @q })
    
  2. or download this
    (?:(?{local $q [0] = $nodes [0]})|
       (?{local $q [0] = $nodes [1]})|
    ...
       (?{local $q [1] = $nodes [7]}))
    (?(?{$q [1] eq $q [0] ||
         !$graph {$q [0]} {$q [1]}})x|)
    
  3. or download this
    (?:(?{local $q [2] = $nodes [0]})|
       (?{local $q [2] = $nodes [1]})|
    ...
    (?(?{$q [2] eq $q [0] ||
         $q [2] eq $q [1] ||
         !$graph {$q [1]} {$q [2]}})x|)
    
  4. or download this
    (?:(?{local $q [0] = $nodes [0]})|   (?:(?{local $q [1] = $nodes [0]})
    +|    (?:(?{local $q [2] = $nodes [0]})|
       (?{local $q [0] = $nodes [1]})|      (?{local $q [1] = $nodes [1]})
    +|       (?{local $q [2] = $nodes [1]})|
    ...
                                              !$graph {$q [0]} {$q [1]}})x
    +|)         $q [2] eq $q [1] ||
                                                                          
    +          !$graph {$q [1]} {$q [2]}})x|)
    
  5. or download this
    (?:(?{local $q [2] = $nodes [0]})|
       (?{local $q [2] = $nodes [1]})|
    ...
    (?(?{$q [2] eq $q [0] ||
         $q [2] eq $q [1] ||
         !$graph {$q [1]} {$q [2]}})x|)
    
  6. or download this
    (?: exp1 | exp2 | exp3 ... )
    
  7. or download this
    # The second element was missing from the first group.
    (? (?{ $q[1] eq $q[0] ||                                     !$graph{$
    +q [0]}{$q [1]} } ) x | )
    (? (?{ $q[2] eq $q[0] || $q[2] eq $q[1] ||                   !$graph{$
    +q [1]}{$q [2]} } ) x | )
    (? (?{ $q[3] eq $q[0] || $q[3] eq $q[1] || $q[3] eq $q[2] || !$graph{$
    +q [2]}{$q [3]} } ) x | )
    
  8. or download this
    if(cond)
       re_1
    else
       re_2
    
  9. or download this
    if ("" =~ /$regex/x) {
    
  10. or download this
    # null.
    $q[1] eq $q[0] ||                                     !$graph{$q [0]}{
    +$q [1]}
    $q[2] eq $q[0] || $q[2] eq $q[1] ||                   !$graph{$q [1]}{
    +$q [2]}
    $q[3] eq $q[0] || $q[3] eq $q[1] || $q[3] eq $q[2] || !$graph{$q [2]}{
    +$q [3]}
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://282139]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2018-04-22 16:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?