This project is a simply implementation of the python Graphviz library functionality in Scala.
It tries to keep the interface the same with the python Graphviz library, which facilitates the creation and rendering of graph descriptions in the DOT language of the Graphviz graph drawing software(repo) from Scala.
To render the generated DOT source code, you also need to install Graphviz.
Make sure that the directory containing the dot
executable is on your
systems' path.
If you are using ubuntu, use the following command to install graphviz:
sudo apt-get install graphviz
bash scripts/build.sh
bash scripts/run_all_examples.sh
import com.liangdp.graphviz4s.Digraph
val dot = new Digraph(comment = "The Round Table")
dot.node("A", "King Arthur")
dot.node("B", "Sir Bedevere the Wise")
dot.node("L", "Sir Lancelot the Brave")
import scala.collection.mutable.Map
dot.edges(Array(("A", "B"), ("A", "L")))
dot.edge("B", "L", attrs = Map("constraint" -> "false"))
println(dot.source())
// The Round Table
digraph {
"A" [label="King Arthur" ]
"B" [label="Sir Bedevere the Wise" ]
"L" [label="Sir Lancelot the Brave" ]
A -> B
A -> L
B -> L [ constraint=false]
}
dot.render(fileName = "round-table.gv", directory = ".", view = true)
The following platforms are supported by this package:
OS | Architecture |
---|---|
Linux | x86_64 |
Linux | x86_32 |