# Is the rpart CART algorithm deterministic? Why are the plots for the CP different?

I'm fitting regression and classification trees. I thought that the algorithm to fit the tree led to the same result each time. However, when I run the line below

tree1 <- rpart(log_bid_price ~ ., minbucket = 5, cp = 0.001, data = HC, method = "anova")


I get differing plots for the cross-validation parameter. I generate the plot using

plotcp(tree1)


What changes between the two plots?

I believe @Christoph is correct. Yes, the algorithm is deterministic. Using printcp you can see what plotcp is plotting. The rel error is consistent between runs. This is a metric for error computed from the training data.