0 | |
From 185b53d8b5adc94dd58c8fb65b75b39e0cd4152a Mon Sep 17 00:00:00 2001
|
1 | |
From: zimond <zimond@zimonddeMacBook-Pro.local>
|
2 | |
Date: Tue, 30 Oct 2018 14:04:15 +0800
|
3 | |
Subject: [PATCH] upgrade bincode, indexmap, quickcheck and rand
|
4 | |
|
5 | |
---
|
6 | |
Cargo.toml | 12 +++++-----
|
7 | |
README.rst | 4 ++--
|
8 | |
serialization-tests/Cargo.toml | 6 ++---
|
9 | |
serialization-tests/tests/serialization.rs | 2 +-
|
10 | |
src/graphmap.rs | 26 +++++++++++-----------
|
11 | |
src/lib.rs | 2 +-
|
12 | |
src/quickcheck.rs | 3 ++-
|
13 | |
tests/unionfind.rs | 6 ++---
|
14 | |
8 files changed, 32 insertions(+), 29 deletions(-)
|
15 | |
|
16 | |
--- a/README.rst
|
17 | |
+++ b/README.rst
|
18 | |
@@ -198,7 +198,7 @@
|
19 | |
- ``GraphMap`` can now have directed edges. ``GraphMap::new`` is now generic
|
20 | |
in the edge type. ``DiGraphMap`` and ``UnGraphMap`` are new type aliases.
|
21 | |
- Add type aliases ``DiGraph, UnGraph, StableDiGraph, StableUnGraph``
|
22 | |
- - ``GraphMap`` is based on the ordermap crate. Deterministic iteration
|
23 | |
+ - ``GraphMap`` is based on the indexmap crate. Deterministic iteration
|
24 | |
order, faster iteration, no side tables needed to convert to ``Graph``.
|
25 | |
- Improved docs for a lot of types and functions.
|
26 | |
- Add graph visitor ``DfsPostOrder``
|
27 | |
@@ -308,7 +308,7 @@
|
28 | |
- Add Graph::capacity(), GraphMap::capacity()
|
29 | |
- Fix bug in Graph::reverse()
|
30 | |
- Graph and GraphMap have `quickcheck::Arbitrary` implementations,
|
31 | |
- if optional feature `quickcheck` is enabled.
|
32 | |
+ if optional feature `check` is enabled.
|
33 | |
|
34 | |
- 0.1.16
|
35 | |
|
36 | |
--- a/src/graphmap.rs
|
37 | |
+++ b/src/graphmap.rs
|
38 | |
@@ -14,11 +14,11 @@
|
39 | |
use std::ops::{Index, IndexMut, Deref};
|
40 | |
use std::iter::FromIterator;
|
41 | |
use std::marker::PhantomData;
|
42 | |
-use ordermap::OrderMap;
|
43 | |
-use ordermap::{
|
44 | |
- Iter as OrderMapIter, IterMut as OrderMapIterMut
|
45 | |
+use indexmap::IndexMap;
|
46 | |
+use indexmap::map::{
|
47 | |
+ Iter as IndexMapIter, IterMut as IndexMapIterMut
|
48 | |
};
|
49 | |
-use ordermap::Keys;
|
50 | |
+use indexmap::map::Keys;
|
51 | |
|
52 | |
use {
|
53 | |
EdgeType,
|
54 | |
@@ -72,8 +72,8 @@
|
55 | |
/// Depends on crate feature `graphmap` (default).
|
56 | |
#[derive(Clone)]
|
57 | |
pub struct GraphMap<N, E, Ty> {
|
58 | |
- nodes: OrderMap<N, Vec<(N, CompactDirection)>>,
|
59 | |
- edges: OrderMap<(N, N), E>,
|
60 | |
+ nodes: IndexMap<N, Vec<(N, CompactDirection)>>,
|
61 | |
+ edges: IndexMap<(N, N), E>,
|
62 | |
ty: PhantomData<Ty>,
|
63 | |
}
|
64 | |
|
65 | |
@@ -121,8 +121,8 @@
|
66 | |
/// Create a new `GraphMap` with estimated capacity.
|
67 | |
pub fn with_capacity(nodes: usize, edges: usize) -> Self {
|
68 | |
GraphMap {
|
69 | |
- nodes: OrderMap::with_capacity(nodes),
|
70 | |
- edges: OrderMap::with_capacity(edges),
|
71 | |
+ nodes: IndexMap::with_capacity(nodes),
|
72 | |
+ edges: IndexMap::with_capacity(edges),
|
73 | |
ty: PhantomData,
|
74 | |
}
|
75 | |
}
|
76 | |
@@ -559,7 +559,7 @@
|
77 | |
Ty: EdgeType
|
78 | |
{
|
79 | |
from: N,
|
80 | |
- edges: &'a OrderMap<(N, N), E>,
|
81 | |
+ edges: &'a IndexMap<(N, N), E>,
|
82 | |
iter: Neighbors<'a, N, Ty>,
|
83 | |
}
|
84 | |
|
85 | |
@@ -596,7 +596,7 @@
|
86 | |
}
|
87 | |
|
88 | |
pub struct AllEdges<'a, N, E: 'a, Ty> where N: 'a + NodeTrait {
|
89 | |
- inner: OrderMapIter<'a, (N, N), E>,
|
90 | |
+ inner: IndexMapIter<'a, (N, N), E>,
|
91 | |
ty: PhantomData<Ty>,
|
92 | |
}
|
93 | |
|
94 | |
@@ -640,7 +640,7 @@
|
95 | |
}
|
96 | |
|
97 | |
pub struct AllEdgesMut<'a, N, E: 'a, Ty> where N: 'a + NodeTrait {
|
98 | |
- inner: OrderMapIterMut<'a, (N, N), E>,
|
99 | |
+ inner: IndexMapIterMut<'a, (N, N), E>,
|
100 | |
ty: PhantomData<Ty>,
|
101 | |
}
|
102 | |
|
103 | |
@@ -815,7 +815,7 @@
|
104 | |
}
|
105 | |
|
106 | |
pub struct NodeIdentifiers<'a, N, E: 'a, Ty> where N: 'a + NodeTrait {
|
107 | |
- iter: OrderMapIter<'a, N, Vec<(N, CompactDirection)>>,
|
108 | |
+ iter: IndexMapIter<'a, N, Vec<(N, CompactDirection)>>,
|
109 | |
ty: PhantomData<Ty>,
|
110 | |
edge_ty: PhantomData<E>,
|
111 | |
}
|
112 | |
@@ -847,7 +847,7 @@
|
113 | |
}
|
114 | |
|
115 | |
pub struct NodeReferences<'a, N, E: 'a, Ty> where N: 'a + NodeTrait {
|
116 | |
- iter: OrderMapIter<'a, N, Vec<(N, CompactDirection)>>,
|
117 | |
+ iter: IndexMapIter<'a, N, Vec<(N, CompactDirection)>>,
|
118 | |
ty: PhantomData<Ty>,
|
119 | |
edge_ty: PhantomData<E>,
|
120 | |
}
|
121 | |
--- a/src/lib.rs
|
122 | |
+++ b/src/lib.rs
|
123 | |
@@ -19,7 +19,7 @@
|
124 | |
|
125 | |
extern crate fixedbitset;
|
126 | |
#[cfg(feature = "graphmap")]
|
127 | |
-extern crate ordermap;
|
128 | |
+extern crate indexmap;
|
129 | |
|
130 | |
#[cfg(feature = "serde-1")]
|
131 | |
extern crate serde;
|
132 | |
--- a/src/quickcheck.rs
|
133 | |
+++ b/src/quickcheck.rs
|
134 | |
@@ -1,6 +1,7 @@
|
135 | |
extern crate quickcheck;
|
136 | |
-
|
137 | |
+extern crate rand;
|
138 | |
use self::quickcheck::{Gen, Arbitrary};
|
139 | |
+use self::rand::Rng;
|
140 | |
|
141 | |
use {
|
142 | |
Graph,
|
143 | |
--- a/tests/unionfind.rs
|
144 | |
+++ b/tests/unionfind.rs
|
145 | |
@@ -1,7 +1,7 @@
|
146 | |
extern crate rand;
|
147 | |
extern crate petgraph;
|
148 | |
|
149 | |
-use rand::{Rng, thread_rng, ChaChaRng};
|
150 | |
+use rand::{Rng, thread_rng, ChaChaRng, SeedableRng};
|
151 | |
use std::collections::HashSet;
|
152 | |
use petgraph::unionfind::UnionFind;
|
153 | |
|
154 | |
@@ -36,7 +36,7 @@
|
155 | |
#[test]
|
156 | |
fn uf_rand() {
|
157 | |
let n = 1 << 14;
|
158 | |
- let mut rng: ChaChaRng = thread_rng().gen();
|
159 | |
+ let mut rng = ChaChaRng::from_rng(thread_rng()).unwrap();
|
160 | |
let mut u = UnionFind::new(n);
|
161 | |
for _ in 0..100 {
|
162 | |
let a = rng.gen_range(0, n);
|
163 | |
@@ -50,7 +50,7 @@
|
164 | |
#[test]
|
165 | |
fn uf_u8() {
|
166 | |
let n = 256;
|
167 | |
- let mut rng: ChaChaRng = thread_rng().gen();
|
168 | |
+ let mut rng = ChaChaRng::from_rng(thread_rng()).unwrap();
|
169 | |
let mut u = UnionFind::<u8>::new(n);
|
170 | |
for _ in 0..(n * 8) {
|
171 | |
let a = rng.gen();
|
172 | |
--- a/Cargo.toml
|
173 | |
+++ b/Cargo.toml
|
174 | |
@@ -36,12 +36,12 @@
|
175 | |
[dependencies.fixedbitset]
|
176 | |
version = "0.1.4"
|
177 | |
|
178 | |
-[dependencies.ordermap]
|
179 | |
-version = "0.3.0"
|
180 | |
+[dependencies.indexmap]
|
181 | |
+version = ">= 1.0.2"
|
182 | |
optional = true
|
183 | |
|
184 | |
[dependencies.quickcheck]
|
185 | |
-version = "0.4"
|
186 | |
+version = ">= 0.7, < 0.9"
|
187 | |
optional = true
|
188 | |
default-features = false
|
189 | |
|
190 | |
@@ -63,13 +63,19 @@
|
191 | |
version = "0.2.19"
|
192 | |
|
193 | |
[dev-dependencies.rand]
|
194 | |
-version = "0.3"
|
195 | |
+version = "0.5"
|
196 | |
+
|
197 | |
+[dependencies.rand]
|
198 | |
+version = "0.5"
|
199 | |
+optional = true
|
200 | |
|
201 | |
[features]
|
202 | |
-all = ["unstable", "quickcheck", "stable_graph", "graphmap"]
|
203 | |
+all = ["unstable", "check", "stable_graph", "graphmap"]
|
204 | |
+check = ["quickcheck", "rand"]
|
205 | |
default = ["graphmap", "stable_graph"]
|
206 | |
generate = []
|
207 | |
-graphmap = ["ordermap"]
|
208 | |
+graphmap = ["indexmap"]
|
209 | |
+ordermap = ["indexmap"]
|
210 | |
serde-1 = ["serde", "serde_derive"]
|
211 | |
stable_graph = []
|
212 | |
unstable = ["generate"]
|