We consider a real-valued path; it is possible to associate a tree to this path, and we explore the relations between the tree, the properties of p-variation of the path, and integration with respect to the path. In particular, the fractal dimension of the tree is estimated from the variations of the path, and Young integrals with respect to the path, as well as integrals from the rough paths theory, are written as integrals on the tree. Examples include some stochastic paths such as martingales, Lévy processes and fractional Brownian motions (for which an estimator of the Hurst parameter is given).