private static bool IsEqual(INode nodeA, INode nodeB)
{
if (nodeA.IsLeaf() ^ nodeB.IsLeaf())
{
throw new Exception("Identical nodes should be at the same height");
}
Assert.IsTrue(nodeA.LeftEdge().Direction == nodeB.LeftEdge().Direction);
Assert.IsTrue(nodeA.RightEdge().Direction == nodeB.RightEdge().Direction);
Assert.IsTrue(nodeA.LeftEdge().Orientation == nodeB.LeftEdge().Orientation);
Assert.IsTrue(nodeA.RightEdge().Orientation == nodeB.RightEdge().Orientation);
if (nodeA.IsLeaf() && nodeB.IsLeaf())
{
return true;
}
return IsEqual(nodeA.Left(), nodeB.Left()) && IsEqual(nodeA.Right(), nodeB.Right());
}