Advertisement
hugofirth

Untitled

Oct 21st, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.25 KB | None | 0 0
  1. val adjList: Map[Int, List[Int]] =
  2.   Map((1, List(2)),(2, List(1,3)),(3, List(2)))
  3.  
  4. val vertices = adjList.keySet.zipWithIndex
  5.  
  6. for((vertex, idx) <- vertices)
  7. {
  8.   println(vertices.map({case (v,i) => if(adjList.get(vertex).get.contains(v)) 1 else 0}))
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement