aboutsummaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
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)
tree64bfa2ceb6579f32f9bb8ce23be26dc04b59741c /README.md
parent634066313810b6b19ce7f4248b4f39b662c4f6ce (diff)
downloadcircgraph-fdc498db3af5cb36765cf5f0da6296a4033b91b7.zip
circgraph-fdc498db3af5cb36765cf5f0da6296a4033b91b7.tar.gz
circgraph-fdc498db3af5cb36765cf5f0da6296a4033b91b7.tar.bz2
circgraph-fdc498db3af5cb36765cf5f0da6296a4033b91b7.tar.xz
Add documentation
Diffstat (limited to 'README.md')
-rw-r--r--README.md41
1 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
+make
```
+Run as:
+
+```
+./circgraph
+```
+
+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
+below:
+
+```
+a c
+a b 1
+a c 1
+b c 1
+```
+
+![test5](https://github.com/built1n/circgraph/raw/master/tests/test5.png)
+
+See the `testX.txt` files for further examples.