However, there are many other kinds of directed acyclic graph that are not formed by orienting the edges of an undirected acyclic graph. In mathematics, particularly graph theory, and computer science, a directed acyclic graph (DAG or dag (listen)) is a finite directed graph with no directed cycles.

COMING SOON!

```
package org.gs.digraph
import scala.annotation.tailrec
import scala.collection.mutable.ListBuffer
/** Solves for shortest path from a source where edge weights can be positive, negative, or zero
*
* Uses [[org.gs.digraph.Topological]] order
*
* @constructor creates a new AcyclicSP with a digraph and source vertex
* @param g acyclic digraph, edges have direction and weight
* @param s source vertex
* @see [[https://algs4.cs.princeton.edu/44sp/AcyclicSP.java.html]]
* @author Scala translation by Gary Struthers from Java by Robert Sedgewick and Kevin Wayne.
*/
class AcyclicSP(g: EdgeWeightedDigraph, s: Int) {
private val _distTo = Array.fill[Double](g.numV)(Double.PositiveInfinity)
_distTo(s) = 0.0
private val edgeTo = Array.fill[Option[DirectedEdge]](g.numV)(None)
private val topological = new Topological(g)
topological.order match {
case None => throw new IllegalArgumentException(s"EdgeWeightedDigraph:$g is not acyclic")
case Some(x) => for {
v <- x
e <- g.adj(v)
} relax(e)
}
private def relax(e: DirectedEdge): Unit = {
val v = e.from
val w = e.to
if (_distTo(w) > _distTo(v) + e.weight) {
_distTo(w) = _distTo(v) + e.weight
edgeTo(w) = Some(e)
}
}
/** returns length of shortest path from source to v */
def distTo(v: Int): Double = _distTo(v)
/** returns if there is a path from source to v */
def hasPathTo(v: Int): Boolean = _distTo(v) < Double.PositiveInfinity
/** returns path from source to v if it exists */
def pathTo(v: Int): Option[Seq[DirectedEdge]] = {
if (!hasPathTo(v)) None else {
val path = new ListBuffer[DirectedEdge]()
@tailrec
def loop(e: DirectedEdge) {
e +=: path
edgeTo(e.from) match {
case None =>
case Some(x) => loop(x)
}
}
edgeTo(v) match {
case None =>
case Some(x) => loop(x)
}
Some(path.toSeq)
}
}
}
```