You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we want to write a **generator** that implements these 2 browsing policies from a graph and vertex.
89
-
101
+
we want to write a **generator** that implements these 2 browsing policies from a graph and vertex.
90
102
of course, only the nodes reachable from the entry vertex will be browsed by this method
91
103
92
104
+++
93
105
94
106
## algorithms
95
107
96
-
the 2 algorithms used to perform these scans are, interestingly, **very close** to one another
97
-
108
+
the 2 algorithms used to perform these scans are, interestingly, **very close** to one another
98
109
in both cases we need a STORAGE object, where we can `store()` things and `retrieve()` them later on
99
110
100
111
+++
@@ -108,9 +119,12 @@ Let us consider the following 2 storage implementations:
108
119
*`Fifo` implements a *first-in-first-out* policy
109
120
*`Filo` does the exact opposite and has a *first-in-last-out* policy
110
121
122
+
```{admonition} list or deque
123
+
111
124
Remember the regular `list` class is more optimized for a `append()/pop()` usage
112
125
113
126
So to work around that, we're using a `deque` class, instead of a simple list; it is actually useful only in the `Filo` case, but this way we have a more homogeneous code
127
+
```
114
128
115
129
**Exercise**: you may wish to factorize both into a single class...
0 commit comments