Merge pull request #33 from bluss/release
Release
diff --git a/Cargo.toml b/Cargo.toml
index 82ba786..9a9e878 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,7 +1,7 @@
[package]
name = "petgraph"
-version = "0.1.16"
+version = "0.1.17"
license = "MIT/Apache-2.0"
authors = [
"bluss",
diff --git a/Makefile b/Makefile
index 79a3908..f324d24 100644
--- a/Makefile
+++ b/Makefile
@@ -7,7 +7,7 @@
VERSIONS = $(patsubst %,target/VERS/%,$(DOCCRATES))
-docs: mkdocs subst $(RMDOCS)
+docs: mkdocs mksvgs subst $(RMDOCS)
# https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html
$(VERSIONS): Cargo.toml
@@ -30,5 +30,9 @@
rm -r ./doc/$@
sed -i "/searchIndex\['$@'\]/d" doc/search-index.js
+mksvgs: mkdocs graph-example.dot
+ dot -Tsvg < ./graph-example.dot > graph-example.svg
+ mv graph-example.svg ./doc/petgraph/graph/
-.PHONY: docs mkdocs subst $(DOCCRATES) $(RMDOCS)
+
+.PHONY: docs mkdocs mksvgs subst $(DOCCRATES) $(RMDOCS)
diff --git a/README.rst b/README.rst
index 1e490fe..35330cf 100644
--- a/README.rst
+++ b/README.rst
@@ -19,6 +19,13 @@
Recent Changes
--------------
+- 0.1.17
+
+ - Add Graph::capacity(), GraphMap::capacity()
+ - Fix bug in Graph::reverse()
+ - Graph and GraphMap have `quickcheck::Arbitrary` implementations,
+ if optional feature `quickcheck` is enabled.
+
- 0.1.16
- Add Graph::node_indices(), Graph::edge_indices()
diff --git a/graph-example.dot b/graph-example.dot
new file mode 100644
index 0000000..f78ce41
--- /dev/null
+++ b/graph-example.dot
@@ -0,0 +1,15 @@
+digraph {
+rankdir = "LR";
+splines = true;
+
+ 0 [label="petgraph"]
+ 1 [label="fixedbitset"]
+ 2 [label="quickcheck"]
+ 3 [label="rand"]
+ 4 [label="libc"]
+ 0 -> 1
+ 0 -> 2
+ 2 -> 3
+ 3 -> 4
+ 2 -> 4
+}
diff --git a/src/graph.rs b/src/graph.rs
index 726439c..46487cc 100644
--- a/src/graph.rs
+++ b/src/graph.rs
@@ -203,8 +203,29 @@
/// - Edge type `Ty` that determines whether the graph edges are directed or undirected.
/// - Index type `Ix`, which determines the maximum size of the graph.
///
+/// The graph uses **O(|V| + |E|)** space, and allows fast node and edge insert
+/// efficient graph search and graph algorithms.
+/// It implements **O(e')** edge lookup and edge and node removals, where **e'**
+/// is some local measure of edge count.
/// Based on the graph datastructure used in rustc.
///
+/// ```
+/// use petgraph::Graph;
+///
+/// let mut deps = Graph::<&str, &str>::new();
+/// let pg = deps.add_node("petgraph");
+/// let fb = deps.add_node("fixedbitset");
+/// let qc = deps.add_node("quickcheck");
+/// let rand = deps.add_node("rand");
+/// let libc = deps.add_node("libc");
+/// deps.extend_with_edges(&[
+/// (pg, fb), (pg, qc),
+/// (qc, rand), (rand, libc), (qc, libc),
+/// ]);
+/// ```
+///
+/// ![graph-example](graph-example.svg)
+///
/// ### Graph Indices
///
/// The graph maintains unique indices for nodes and edges, and node and edge
@@ -339,7 +360,7 @@
ty: PhantomData}
}
- /// Return the capacity of the graph's node and edge `Vec`s.
+ /// Return the current node and edge capacity of the graph.
///
/// Computes in **O(1)** time.
pub fn capacity(&self) -> (usize, usize) {
diff --git a/src/graphmap.rs b/src/graphmap.rs
index 9b4c3da..460618d 100644
--- a/src/graphmap.rs
+++ b/src/graphmap.rs
@@ -68,7 +68,7 @@
}
}
- /// Return the capacity of the graph's node and edge `HashMap`s.
+ /// Return the current node and edge capacity of the graph.
pub fn capacity(&self) -> (usize, usize) {
(self.nodes.capacity(), self.edges.capacity())
}