diff options
authorFranklin Wei <me@fwei.tk>2019-03-12 12:23:10 -0400
committerFranklin Wei <me@fwei.tk>2019-03-12 12:23:10 -0400
commitfdc498db3af5cb36765cf5f0da6296a4033b91b7 (patch)
parent634066313810b6b19ce7f4248b4f39b662c4f6ce (diff)
Add documentation
-rw-r--r--tests/test1.pngbin0 -> 12253 bytes
-rw-r--r--tests/test1.txt (renamed from test1.txt)0
-rw-r--r--tests/test2.pngbin0 -> 10747 bytes
-rw-r--r--tests/test2.txt (renamed from test2.txt)0
-rw-r--r--tests/test3.pngbin0 -> 12293 bytes
-rw-r--r--tests/test3.txt (renamed from test3.txt)0
-rw-r--r--tests/test4.pngbin0 -> 14208 bytes
-rw-r--r--tests/test4.txt (renamed from test4.txt)0
-rw-r--r--tests/test5.pngbin0 -> 7418 bytes
-rw-r--r--tests/test5.txt (renamed from test5.txt)0
-rw-r--r--tests/test6.pngbin0 -> 34479 bytes
-rw-r--r--tests/test6.txt (renamed from test6.txt)0
-rw-r--r--tests/test7.pngbin0 -> 8491 bytes
-rw-r--r--tests/test7.txt (renamed from test7.txt)0
-rw-r--r--tests/test8.pngbin0 -> 5812 bytes
-rw-r--r--tests/test8.txt (renamed from test8.txt)0
-rw-r--r--tests/test9.pngbin0 -> 14936 bytes
-rw-r--r--tests/test9.txt (renamed from test9.txt)0
-rwxr-xr-xtests/testgraph.sh (renamed from testgraph.sh)0
20 files changed, 39 insertions, 2 deletions
diff --git a/README.md b/README.md
index e8c602d..d4b6524 100644
--- a/README.md
+++ b/README.md
@@ -16,9 +16,30 @@ you?
Compile with:
-g++ main.cpp -o circgraph
+Run as:
+By default, `circgraph` will read a circuit from stdin (see below) and
+output the equivalent resistance between the source and sink. The `-C`
+flag will switch the calculation mode to capacitance.
+`circgraph` can output graphs in Graphviz's `dot` format to stdout for
+visualization. Pass stdout to `tests/testgraph.sh` to try (requires
+graphviz and evince).
+# Circuit Input
+`circgraph` represents circuits as weighted undirected graphs, with
+nodes representing electrically common elements (i.e. a wire) and
+edges and their weights representing either resistors or capacitors
+(depending on command-line options).
`circgraph` takes input from stdin in the following format:
@@ -28,4 +49,20 @@ g++ main.cpp -o circgraph
-See the `testX.txt` files for examples.
+The first line specifies the names of the source and sink nodes. All
+subsequent lines represent a weighted edge with the names of the two
+nodes and the weight of the edge. Node names are created upon use.
+An example input (test5.txt) and its corresponding graph are given
+a c
+a b 1
+a c 1
+b c 1
+See the `testX.txt` files for further examples.
diff --git a/tests/test1.png b/tests/test1.png
new file mode 100644
index 0000000..11cc3bb
--- /dev/null
+++ b/tests/test1.png
Binary files differ
diff --git a/test1.txt b/tests/test1.txt
index c9fdb03..c9fdb03 100644
--- a/test1.txt
+++ b/tests/test1.txt
diff --git a/tests/test2.png b/tests/test2.png
new file mode 100644
index 0000000..4734e2a
--- /dev/null
+++ b/tests/test2.png
Binary files differ
diff --git a/test2.txt b/tests/test2.txt
index 2bc0bf7..2bc0bf7 100644
--- a/test2.txt
+++ b/tests/test2.txt
diff --git a/tests/test3.png b/tests/test3.png
new file mode 100644
index 0000000..2ee7581
--- /dev/null
+++ b/tests/test3.png
Binary files differ
diff --git a/test3.txt b/tests/test3.txt
index e6ba9b6..e6ba9b6 100644
--- a/test3.txt
+++ b/tests/test3.txt
diff --git a/tests/test4.png b/tests/test4.png
new file mode 100644
index 0000000..0234671
--- /dev/null
+++ b/tests/test4.png
Binary files differ
diff --git a/test4.txt b/tests/test4.txt
index 3b57188..3b57188 100644
--- a/test4.txt
+++ b/tests/test4.txt
diff --git a/tests/test5.png b/tests/test5.png
new file mode 100644
index 0000000..0110633
--- /dev/null
+++ b/tests/test5.png
Binary files differ
diff --git a/test5.txt b/tests/test5.txt
index 1f11f98..1f11f98 100644
--- a/test5.txt
+++ b/tests/test5.txt
diff --git a/tests/test6.png b/tests/test6.png
new file mode 100644
index 0000000..3049298
--- /dev/null
+++ b/tests/test6.png
Binary files differ
diff --git a/test6.txt b/tests/test6.txt
index 567126c..567126c 100644
--- a/test6.txt
+++ b/tests/test6.txt
diff --git a/tests/test7.png b/tests/test7.png
new file mode 100644
index 0000000..a896ecd
--- /dev/null
+++ b/tests/test7.png
Binary files differ
diff --git a/test7.txt b/tests/test7.txt
index e787b78..e787b78 100644
--- a/test7.txt
+++ b/tests/test7.txt
diff --git a/tests/test8.png b/tests/test8.png
new file mode 100644
index 0000000..dd4d265
--- /dev/null
+++ b/tests/test8.png
Binary files differ
diff --git a/test8.txt b/tests/test8.txt
index 2586c3d..2586c3d 100644
--- a/test8.txt
+++ b/tests/test8.txt
diff --git a/tests/test9.png b/tests/test9.png
new file mode 100644
index 0000000..253b8d5
--- /dev/null
+++ b/tests/test9.png
Binary files differ
diff --git a/test9.txt b/tests/test9.txt
index a8ec4a0..a8ec4a0 100644
--- a/test9.txt
+++ b/tests/test9.txt
diff --git a/testgraph.sh b/tests/testgraph.sh
index c63ab72..c63ab72 100755
--- a/testgraph.sh
+++ b/tests/testgraph.sh