     _ transitionMatrix: [Double]
   ) {
     precondition(transitionMatrix.count == stateCount * stateCount)
+    self.edges = Tuple2(inputId1, inputId2)
     self.stateCount = stateCount
     self.transitionMatrix = transitionMatrix
   }
 
-  func error(at label1: Int, _ label2: Int) -> Double {
+  func error(at q: Variables) -> Double {
+    let (label1, label2) = (q.head, q.tail.head)
     return -log(transitionMatrix[label2 * stateCount + label1])
   }
 }

@testable import SwiftFusion

/// A factor on two discrete labels evaluation the transition probability
struct DiscreteTransitionFactor {
  /// The number of states.
  let stateCount: Int


    let movements = [
      Pose2(1, 0, 0),       // go forwards
      Pose2(1, 0, .pi / 4), // turn left
      Pose2(1, 0, -.pi / 4) // turn right
    ]

    var graph = NewFactorGraph()
    graph.store(NewPriorFactor2(x1, Pose2(10, 0, 0)))
    graph.store(NewPriorFactor2(x2, Pose2(11, 0, 0)))
    graph.store(NewPriorFactor2(x3, Pose2(12, 0, 0)))
