Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Finding Hamiltonian Paths using the Regexp Engine

by BrowserUk (Patriarch)
on Aug 08, 2003 at 08:45 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://282139]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (8)
As of 2024-04-23 08:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found