graph.nv
· 1.9 KiB · Text
Ham
Playground
||::(
A - B - C
check if C is connected to A
)
|:: ($A - $B - $C)|
:: ($A -> $B -> $C -> $B -> $A)
|:: ($A - $B)|
:: ($A -> $B -> $A)
|:: ($A -> $B -> $C)|
:: $A is connected to $B
:: ($B -> $C)
|:: ($A -> $B)|
:: $A is connected to $B
|:: ;|
:: clean up
|:: (check if $A is connected to $B)|
:: visit $A
:: trace a path
:: check if $B has been visited before
|:: $A is connected to $B|
:connections: $A $B
|:: visit $A|
:: mark $A as visited
:: get neighbors for $A
:: cross off any visited neighbors
|:: trace a path? :neighbors: $A|
:: visit $A
|:: trace a path|
|:: get neighbors for $A :no more connections:|
|:: get neighbors for $A? :connections: $A $B?|
:: next connection :neighbors: $B
|:: get neighbors for $A?|
:: next connection
|:: next connection :connections: $A $B|
:checked connections: $A $B
|:: next connection|
:: reset connections
:no more connections:
|:: mark $A as visited :yes:|
|:: mark $A as visited :no:|
:visited: $A
|:: mark $A as visited?|
:: check if $A has been visited before
|:: check if $A has been visited before :visited: $A?|
:: reset visited :yes:
|:: check if $A has been visited before? :visited: $B|
:checked visited: $B
|:: check if $A has been visited before|
:: reset visited :no:
|:: cross off any visited neighbors? :yes: :neighbors: $A|
|:: cross off any visited neighbors? :no: :neighbors: $A|
:checked neighbors: $A
|:: cross off any visited neighbors? :neighbors: $A?|
:: check if $A has been visited before
|:: cross off any visited neighbors|
:: reset neighbors
|:: reset connections? :checked connections: $A $B|
:connections: $A $B
|:: reset visited? :checked visited: $A|
:visited: $A
|:: reset neighbors? :checked neighbors: $A|
:neighbors: $A
|:: reset $|
|:: clean up? :neighbors: $A|
|:: clean up? :visited: $A|
|:: clean up|
| 1 | ||::( |
| 2 | A - B - C |
| 3 | |
| 4 | check if C is connected to A |
| 5 | ) |
| 6 | |
| 7 | |:: ($A - $B - $C)| |
| 8 | :: ($A -> $B -> $C -> $B -> $A) |
| 9 | |:: ($A - $B)| |
| 10 | :: ($A -> $B -> $A) |
| 11 | |
| 12 | |:: ($A -> $B -> $C)| |
| 13 | :: $A is connected to $B |
| 14 | :: ($B -> $C) |
| 15 | |:: ($A -> $B)| |
| 16 | :: $A is connected to $B |
| 17 | |:: ;| |
| 18 | :: clean up |
| 19 | |
| 20 | |:: (check if $A is connected to $B)| |
| 21 | :: visit $A |
| 22 | :: trace a path |
| 23 | :: check if $B has been visited before |
| 24 | |
| 25 | |:: $A is connected to $B| |
| 26 | :connections: $A $B |
| 27 | |
| 28 | |:: visit $A| |
| 29 | :: mark $A as visited |
| 30 | :: get neighbors for $A |
| 31 | :: cross off any visited neighbors |
| 32 | |
| 33 | |:: trace a path? :neighbors: $A| |
| 34 | :: visit $A |
| 35 | |:: trace a path| |
| 36 | |
| 37 | |:: get neighbors for $A :no more connections:| |
| 38 | |:: get neighbors for $A? :connections: $A $B?| |
| 39 | :: next connection :neighbors: $B |
| 40 | |:: get neighbors for $A?| |
| 41 | :: next connection |
| 42 | |
| 43 | |:: next connection :connections: $A $B| |
| 44 | :checked connections: $A $B |
| 45 | |:: next connection| |
| 46 | :: reset connections |
| 47 | :no more connections: |
| 48 | |
| 49 | |:: mark $A as visited :yes:| |
| 50 | |:: mark $A as visited :no:| |
| 51 | :visited: $A |
| 52 | |:: mark $A as visited?| |
| 53 | :: check if $A has been visited before |
| 54 | |
| 55 | |:: check if $A has been visited before :visited: $A?| |
| 56 | :: reset visited :yes: |
| 57 | |:: check if $A has been visited before? :visited: $B| |
| 58 | :checked visited: $B |
| 59 | |:: check if $A has been visited before| |
| 60 | :: reset visited :no: |
| 61 | |
| 62 | |:: cross off any visited neighbors? :yes: :neighbors: $A| |
| 63 | |:: cross off any visited neighbors? :no: :neighbors: $A| |
| 64 | :checked neighbors: $A |
| 65 | |:: cross off any visited neighbors? :neighbors: $A?| |
| 66 | :: check if $A has been visited before |
| 67 | |:: cross off any visited neighbors| |
| 68 | :: reset neighbors |
| 69 | |
| 70 | |:: reset connections? :checked connections: $A $B| |
| 71 | :connections: $A $B |
| 72 | |:: reset visited? :checked visited: $A| |
| 73 | :visited: $A |
| 74 | |:: reset neighbors? :checked neighbors: $A| |
| 75 | :neighbors: $A |
| 76 | |:: reset $| |
| 77 | |
| 78 | |:: clean up? :neighbors: $A| |
| 79 | |:: clean up? :visited: $A| |
| 80 | |:: clean up| |