summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseancarroll <seanc28@gmail.com>2021-03-22 20:06:41 -0500
committerseancarroll <seanc28@gmail.com>2021-03-22 20:06:41 -0500
commite45dc721cd7badb59ffcaceb6bd739b01210112f (patch)
treef4ba1588c1b4bc32144035535bd03eda47e4de1f
parent4d924969fdd445a3dc16938d8968c080cab2ff31 (diff)
downloaddotavious-e45dc721cd7badb59ffcaceb6bd739b01210112f.zip
add quickstart example to readme. include badges in readme
-rw-r--r--README.md46
-rw-r--r--example.dot5
-rw-r--r--readme-example.pngbin0 -> 3671 bytes
3 files changed, 42 insertions, 9 deletions
diff --git a/README.md b/README.md
index 329ad72..a8327b9 100644
--- a/README.md
+++ b/README.md
@@ -1,17 +1,45 @@
# Dotavious
-A library for generating Graphviz DOT language files for graphs.
+[![crates.io](https://meritbadge.herokuapp.com/dotavious)](https://crates.io/crates/dotavious)
+[![Released API docs](https://docs.rs/dotavious/badge.svg)](https://docs.rs/dotavious)
+[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
+[![CI](https://github.com/doctavious/dotavious/workflows/CI/badge.svg)](https://github.com/doctavious/dotavious/actions?query=workflow%3ACI)
+A library for generating [Graphviz](https://graphviz.org/) [DOT](https://graphviz.org/doc/info/lang.html) language files
+for visualizing graphs.
-## Research
+## Constraints / Limitations
-- https://github.com/HongxuChen/dot-rs/blob/master/src/lib.rs
-- https://github.com/lk-chen/dot_parse-rust
-- https://github.com/dylanowen/mdbook-graphviz
-- https://github.com/petgraph/petgraph/blob/master/src/dot.rs
+- Not every Attribute is fully documented/described.
+ However, all those which have specific allowed values should be covered.
+- Deprecated Attributes are not defined.
-I'm not in love with this API design. Will work on building an alternative and see how it goes
-Read https://graphviz.org/doc/info/lang.html
+## Quickstart
-https://www.graphviz.org/pdf/dotguide.pdf \ No newline at end of file
+```rust
+use dotavious::{Dot, Edge, Graph, GraphBuilder, Node};
+use std::io;
+use std::io::Read;
+
+// can also start building a undirected graph via `GraphBuilder::new_undirected`
+let graph = GraphBuilder::new_directed(Some("example".to_string()))
+ .add_node(Node::new("N0".to_string()))
+ .add_node(Node::new("N1".to_string()))
+ .add_edge(Edge::new("N0".to_string(), "N1".to_string()))
+ .build()
+ .unwrap();
+
+let dot = Dot { graph };
+println!("{}", dot);
+```
+which produces
+```
+digraph example {
+ N0;
+ N1;
+ N0 -> N1;
+}
+```
+and when rendered will look like
+![README example rendered](readme-example.png?raw=true)
diff --git a/example.dot b/example.dot
new file mode 100644
index 0000000..53a536a
--- /dev/null
+++ b/example.dot
@@ -0,0 +1,5 @@
+digraph example {
+ N0;
+ N1;
+ N0 -> N1;
+}
diff --git a/readme-example.png b/readme-example.png
new file mode 100644
index 0000000..63d3c28
--- /dev/null
+++ b/readme-example.png
Binary files differ