A characterization of partially dual graphs