You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importscalax.collection.mutable.{Graph=>SGraph}
importscalax.collection.edge.LDiEdgeclassGraph[N, E](privatevalgraph:SGraph[N, LDiEdge]) extendsSerializable {
defaddVertex(vertex: N):Unit= {
graph.add(vertex)
}
defaddEdge(s: N, e: E, t: N):Unit= {
implicitvaledgeCompanion=LDiEdge
graph.addLEdge(s, t)(e)
}
/** * ====== ERROR ====== * Unable to locate class corresponding to inner class entry for Edge$ * in owner scalax.collection.GraphBase*/privatedeftoEdge(e: graph.EdgeT): (N, E, N) = {
(e.source, e.label.asInstanceOf[E], e.target)
}
/** * Map a graph to a new graph, with edge converted to new type * Current graph is not changed.*/defmapEdge[NewEdge](fun: (N, E, N) =>NewEdge):Graph[N, NewEdge] = {
valnewGraph=newGraph[N, NewEdge](SGraph.empty[N, LDiEdge])
graph.foreach {
casen: graph.NodeT=> newGraph.addVertex(n.value)
casee: graph.EdgeT=>val (s, p, t) = toEdge(e)
newGraph.addEdge(s, fun(s, p, t), t)
}
newGraph
}
}
sbt build file
name :="scala-graph-example"
version :="1.0"
scalaVersion :="2.11.8"
libraryDependencies +="org.scala-graph"%%"graph-core"%"1.11.5"
scalacOptions ++=Seq("-Yinline")
The text was updated successfully, but these errors were encountered:
Reproducible with the following codes,
sbt build file
The text was updated successfully, but these errors were encountered: