All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.aiddl.common.scala.math.graph.GraphTools.scala Maven / Gradle / Ivy

Go to download

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