Son aktivite 2 weeks ago

A basic graph traversal algorithm.

june's Avatar june bu gisti düzenledi 2 weeks ago. Düzenlemeye git

1 file changed, 1 insertion, 1 deletion

graph.nv

@@ -77,4 +77,4 @@
77 77
78 78 |:: clean up? :neighbors: $A|
79 79 |:: clean up? :visited: $A|
80 - |:: clean up|
80 + |:: clean up|

june's Avatar june bu gisti düzenledi 2 weeks ago. Düzenlemeye git

1 file changed, 7 insertions, 3 deletions

graph.nv

@@ -1,10 +1,14 @@
1 1 ||::(
2 - 1 -> 2 ;
3 - 1 -> 3 -> 4 -> 3 -> 2 ;
2 + A - B - C
4 3
5 - check if 1 is connected to 4 ;
4 + check if C is connected to A
6 5 )
7 6
7 + |:: ($A - $B - $C)|
8 + :: ($A -> $B -> $C -> $B -> $A)
9 + |:: ($A - $B)|
10 + :: ($A -> $B -> $A)
11 +
8 12 |:: ($A -> $B -> $C)|
9 13 :: $A is connected to $B
10 14 :: ($B -> $C)

june's Avatar june bu gisti düzenledi 2 weeks ago. Düzenlemeye git

1 file changed, 1 insertion, 1 deletion

graph.nv

@@ -2,7 +2,7 @@
2 2 1 -> 2 ;
3 3 1 -> 3 -> 4 -> 3 -> 2 ;
4 4
5 - check if 1 is connected to 2 ;
5 + check if 1 is connected to 4 ;
6 6 )
7 7
8 8 |:: ($A -> $B -> $C)|

june's Avatar june bu gisti düzenledi 2 weeks ago. Düzenlemeye git

1 file changed, 4 insertions, 3 deletions

graph.nv

@@ -2,7 +2,7 @@
2 2 1 -> 2 ;
3 3 1 -> 3 -> 4 -> 3 -> 2 ;
4 4
5 - trace a path, starting from 1
5 + check if 1 is connected to 2 ;
6 6 )
7 7
8 8 |:: ($A -> $B -> $C)|
@@ -13,9 +13,10 @@
13 13 |:: ;|
14 14 :: clean up
15 15
16 - |:: (trace a path, starting from $A)|
16 + |:: (check if $A is connected to $B)|
17 17 :: visit $A
18 18 :: trace a path
19 + :: check if $B has been visited before
19 20
20 21 |:: $A is connected to $B|
21 22 :connections: $A $B
@@ -72,4 +73,4 @@
72 73
73 74 |:: clean up? :neighbors: $A|
74 75 |:: clean up? :visited: $A|
75 - |:: clean up|
76 + |:: clean up|

june's Avatar june bu gisti düzenledi 2 weeks ago. Düzenlemeye git

1 file changed, 75 insertions

graph.nv(dosya oluşturuldu)

@@ -0,0 +1,75 @@
1 + ||::(
2 + 1 -> 2 ;
3 + 1 -> 3 -> 4 -> 3 -> 2 ;
4 +
5 + trace a path, starting from 1
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 + |:: (trace a path, starting from $A)|
17 + :: visit $A
18 + :: trace a path
19 +
20 + |:: $A is connected to $B|
21 + :connections: $A $B
22 +
23 + |:: visit $A|
24 + :: mark $A as visited
25 + :: get neighbors for $A
26 + :: cross off any visited neighbors
27 +
28 + |:: trace a path? :neighbors: $A|
29 + :: visit $A
30 + |:: trace a path|
31 +
32 + |:: get neighbors for $A :no more connections:|
33 + |:: get neighbors for $A? :connections: $A $B?|
34 + :: next connection :neighbors: $B
35 + |:: get neighbors for $A?|
36 + :: next connection
37 +
38 + |:: next connection :connections: $A $B|
39 + :checked connections: $A $B
40 + |:: next connection|
41 + :: reset connections
42 + :no more connections:
43 +
44 + |:: mark $A as visited :yes:|
45 + |:: mark $A as visited :no:|
46 + :visited: $A
47 + |:: mark $A as visited?|
48 + :: check if $A has been visited before
49 +
50 + |:: check if $A has been visited before :visited: $A?|
51 + :: reset visited :yes:
52 + |:: check if $A has been visited before? :visited: $B|
53 + :checked visited: $B
54 + |:: check if $A has been visited before|
55 + :: reset visited :no:
56 +
57 + |:: cross off any visited neighbors? :yes: :neighbors: $A|
58 + |:: cross off any visited neighbors? :no: :neighbors: $A|
59 + :checked neighbors: $A
60 + |:: cross off any visited neighbors? :neighbors: $A?|
61 + :: check if $A has been visited before
62 + |:: cross off any visited neighbors|
63 + :: reset neighbors
64 +
65 + |:: reset connections? :checked connections: $A $B|
66 + :connections: $A $B
67 + |:: reset visited? :checked visited: $A|
68 + :visited: $A
69 + |:: reset neighbors? :checked neighbors: $A|
70 + :neighbors: $A
71 + |:: reset $|
72 +
73 + |:: clean up? :neighbors: $A|
74 + |:: clean up? :visited: $A|
75 + |:: clean up|
Daha yeni Daha eski