@@ -204,6 +204,8 @@ impl<E, Ix: IndexType = DefIndex> Edge<E, Ix>
204
204
///
205
205
/// Based on the graph implementation in rustc.
206
206
///
207
+ /// ### Graph Indices
208
+ ///
207
209
/// The graph maintains unique indices for nodes and edges, and node and edge
208
210
/// weights may be accessed mutably.
209
211
///
@@ -213,11 +215,22 @@ impl<E, Ix: IndexType = DefIndex> Edge<E, Ix>
213
215
/// all indices stable, but removing a node will force the last node to shift its index to
214
216
/// take its place. Similarly, removing an edge shifts the index of the last edge.
215
217
///
216
- /// The fact that the node and edge indices in the graph are numbered in a compact interval from
217
- /// 0 to *n* - 1 simplifies some graph algorithms.
218
- ///
219
218
/// The **Ix** parameter is **u32** by default. The goal is that you can ignore this parameter
220
219
/// completely unless you need a very big graph -- then you can use **usize**.
220
+ ///
221
+ /// ### Tradeoffs With Indices
222
+ ///
223
+ /// * The fact that the node and edge indices in the graph are numbered in a compact interval from
224
+ /// 0 to *n* - 1 simplifies some graph algorithms.
225
+ ///
226
+ /// * You can select graph index integer type after the size of the graph. A smaller
227
+ /// size has better performance due to cache effects.
228
+ ///
229
+ /// * Using indices allows mutation while traversing the graph, see `Dfs`.
230
+ ///
231
+ /// * You can create several graphs using the equal node indices but with
232
+ /// differing weights or differing edges.
233
+ ///
221
234
pub struct Graph < N , E , Ty = Directed , Ix : IndexType = DefIndex > {
222
235
nodes : Vec < Node < N , Ix > > ,
223
236
edges : Vec < Edge < E , Ix > > ,
0 commit comments