Partially commutative monoids provide a powerful tool to study graphs, viewing walks as words whose letters, the edges of the graph, obey a specific commutation rule. A particular class of traces emerges from this framework, the hikes, whose alphabet is the set of simple cycles on the graph. We show that hikes characterize undirected graphs uniquely, up to isomorphism, and satisfy remarkable algebraic properties such as the existence and uniqueness of a prime factorization. Because of this, the set of hikes partially ordered by divisibility hosts a plethora of relations in direct correspondence with those found in number theory. Some applications of these results are presented, including a permanantal extension to MacMahon's master theorem and a derivation of the Ihara zeta function.