diff options
| author | Jack Koenig | 2017-07-14 15:44:39 -0700 |
|---|---|---|
| committer | GitHub | 2017-07-14 15:44:39 -0700 |
| commit | 661147d84d8c27a5b4f051ced12ebf7efecb40dc (patch) | |
| tree | 1c1aa6d11b16c8df024430d8b0d1351aa51ff4f6 /src/main | |
| parent | 49fca68c4f01b4fee6e9ebb9b4fae00dd349c5f4 (diff) | |
Fix bug in DiGraph.reverse on an graph with one vertex, no edges (#628)
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/scala/firrtl/graph/DiGraph.scala | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/scala/firrtl/graph/DiGraph.scala b/src/main/scala/firrtl/graph/DiGraph.scala index e28e53e5..ee00789e 100644 --- a/src/main/scala/firrtl/graph/DiGraph.scala +++ b/src/main/scala/firrtl/graph/DiGraph.scala @@ -295,7 +295,10 @@ class DiGraph[T] (val edges: Map[T, Set[T]]) extends DiGraphLike[T] { /** Returns a graph with all edges reversed */ def reverse: DiGraph[T] = { val mdg = new MutableDiGraph[T] - edges foreach { case (u,edges) => edges.foreach({ v => mdg.addEdge(v,u) }) } + edges.foreach { case (u, edges) => + mdg.addVertex(u) + edges.foreach(v => mdg.addEdge(v,u)) + } DiGraph(mdg) } |
