use id as graph key instead of complete module

This commit is contained in:
Johannes Rudolph 2012-10-21 11:05:50 +02:00
parent dbf1f30d42
commit d19dab955f
1 changed files with 3 additions and 3 deletions

View File

@ -50,14 +50,14 @@ object IvyGraphMLDependencies extends App {
val graph = buildGraph(doc)
import graph._
val deps = {
val m = new HashMap[Module, MSet[Module]] with MultiMap[Module, Module]
edges.foreach { case (from, to) => m.addBinding(from, to) }
val m = new HashMap[String, MSet[Module]] with MultiMap[String, Module]
edges.foreach { case (from, to) => m.addBinding(from.id, to) }
m.toMap.mapValues(_.toSeq.sortBy(_.id))
}
// there should only be one root node (the project itself)
val roots = nodes.filter(n => !edges.exists(_._2 == n)).sortBy(_.id)
roots.map(root =>
Graph.toAscii[Module](root, node => deps.getOrElse(node, Seq.empty[Module]), _.id)
Graph.toAscii[Module](root, node => deps.getOrElse(node.id, Seq.empty[Module]), _.id)
).mkString("\n")
}