org.aiddl.common.scala.math.graph.GraphTools.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aiddl-common-scala Show documentation
Show all versions of aiddl-common-scala Show documentation
Provides common types and algorithm implementations for the fast prototyping integrative AI systems with the AIDDL framework.
The newest version!
package org.aiddl.common.scala.math.graph
import scala.collection.mutable.HashMap
import scala.collection.mutable
import org.aiddl.core.scala.function.Function
import org.aiddl.core.scala.function.Configurable
import org.aiddl.core.scala.representation._
import org.aiddl.common.scala.Common.NIL
import org.aiddl.common.scala.math.graph.Terms._
import org.aiddl.common.scala.math.graph.GraphType._
object GraphTools {
def assembleGraph(n: CollectionTerm, e: CollectionTerm): Tuple =
Tuple(KeyVal(Nodes, n), KeyVal(Edges, e) )
def unpackEdge(x: Term): (GraphType,Term,Term) = {
val v1 = x(0)
val v2 = x(1)
(if (x.isInstanceOf[Tuple]) Directed else Undirected, v1, v2)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy