TUCAN is a canonicalization and serialization algorithm that is independent of domain-specific concepts of structure and bonding. Beyond the atomic number, all invariants used in the partitioning of a molecule are exclusively derived from the molecular topology and therefore make the algorithm also applicable to non-chemical graphs. In particular, the use of "fundamental" (chordless) cycles introduces an invariant of high discriminatory power which enables canonicalization of "difficult" graphs for which the popular Morgan algorithm fails. Extensive benchmarking is reported on a manually curated test set of molecules as well as a library of non-chemical graphs. In addition to the new canonicalization algorithm, the serialization procedure generates a unique "tuple-style" output which is fully bidirectional, allowing the TUCAN string to serve as both identifier and descriptor. Use of the Python NetworkX graph library facilitated a compact and easily extensible implementation.