Skip to content
This repository has been archived by the owner on Mar 11, 2020. It is now read-only.

Fix GDecomp#redecorate #26

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/scala/Decomp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ case class GDecomp[N,A,B](ctx: Context[N,A,B], rest: Graph[N,A,B]) {
*/
def redecorate[C](f: GDecomp[N,A,B] => C): GDecomp[N,C,B] =
GDecomp(ctx.copy(label = f(this)),
rest.gmap { c => c.copy(label = f(rest.decomp(c.vertex).toGDecomp.get)) })
rest.gmap { c => c.copy(label = f(toGraph.decomp(c.vertex).toGDecomp.get)) })

/**
* Decompose the graph on the nodes returned by `f`.
Expand Down
3 changes: 2 additions & 1 deletion core/src/test/scala/GraphGen.scala
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ object GraphGen {

def genGDecomp[N: Arbitrary, A: Arbitrary, B: Arbitrary]: Gen[GDecomp[N,A,B]] = for {
ctx <- arbitrary[Context[N,A,B]]
g <- arbitrary[Graph[N,A,B]]
// The remainder of the graph should not reference the focus of the decomposition or its incident edges
g <- arbitrary[Graph[N,A,B]].map(_.removeNode(ctx.vertex))
} yield GDecomp(ctx, g)

implicit def arbitraryGDecomp[A: Arbitrary, B: Arbitrary, N: Arbitrary]: Arbitrary[GDecomp[N, A, B]] = Arbitrary(genGDecomp[N,A,B])
Expand Down