serialize a dependency tree