Your skill will accomplishwhat 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??

```(?:(?{local \$q [0] = \$nodes [0]})|
(?{local \$q [0] = \$nodes [1]})|
...
\$q [7] eq \$q [6] ||
!\$graph {\$q [6]} {\$q [7]}})x|)
(?{ @path = @q })
```
```(?:(?{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|)
```
```(?:(?{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|)
```
```(?:(?{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|)
```
```(?:(?{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|)
```
```(?: exp1 | exp2 | exp3 ... )
```
```# 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 | )
```
```if(cond)
re_1
else
re_2
```
```if ("" =~ /\$regex/x) {
```
```# 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]}
```

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?
My travels bear the most uncanny semblance to ...

Results (83 votes). Check out past polls.

Notices?