Expand description
Parse an ASCII DAG. Extract edge information. Return a map from names to their parents.
The direction of the graph is automatically detected.
If |
is used, then roots are at the bottom, heads are at the top side.
Otherwise, -
can be used, and roots are at the left, heads are at the
right. |
and -
cannot be used together.
Example:
use drawdag::parse;
let edges = parse(r#"
E
\
C----B----A
/
D-
"#);
let expected = "{\"A\": {\"B\", \"E\"}, \"B\": {\"C\", \"D\"}, \"C\": {}, \"D\": {}, \"E\": {}}";
assert_eq!(format!("{:?}", edges), expected);
let edges = parse(r#"
A
/|
| B
E |
|\
C D
"#);
assert_eq!(format!("{:?}", edges), expected);