mirror of
https://github.com/bertptrs/adventofcode.git
synced 2025-12-25 21:00:31 +01:00
Create graph visualisation for input.
Needed to check if the graph is actually a DAG and whether the degrees are correct.
This commit is contained in:
15
2016/day-10/create-graph.sh
Executable file
15
2016/day-10/create-graph.sh
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "digraph bots {"
|
||||
|
||||
while IFS=' ' read -r -a data; do
|
||||
if [[ ${data[0]} == "value" ]]; then
|
||||
echo "I${data[1]} -> B${data[5]};"
|
||||
else
|
||||
[[ ${data[5]} == "bot" ]] && kind1="B" || kind2="O"
|
||||
[[ ${data[10]} == "bot" ]] && kind2="B" || kind2="O"
|
||||
echo "B${data[1]} -> $kind1${data[6]} [label=lo];"
|
||||
echo "B${data[1]} -> $kind2${data[11]} [label=hi];"
|
||||
fi
|
||||
done
|
||||
echo "}"
|
||||
Reference in New Issue
Block a user