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