Monocyanopolyynes are formed by arcing graphite electrodes in ammonia. This work completes the parallelism existing between the polyynes formed by laser ablation experiments of graphite targets and those produced from the submerged electric arc. In both cases the same products are obtained. The products consist of hydrogen-terminated polyynes if water is present, monocyanopolyynes (mixed with hydrogen-terminated polyynes) if the carbon arc is sparked in acetonitrile or ammonia and dicyanopolyynes if the arc is struck in liquid nitrogen. The mechanism of formation of polyynes in the submerged carbon arc involves essentially neutral species; similar species and pathways may also occur in the circumstellar environment where polyynes have been detected by radioastronomy. It is shown that the relative abundances of the polyynes formed in the submerged carbon arc or in a carbon arc in vacuum decrease by a factor between three and five as the chain length increases by a C2 unit. Exactly the same trend has been observed by radioastronomy both for polyynes and cyanopolyynes in the circumstellar environment around red giants and asymptotic giant branch (AGB) stars. This fact may be a simple coincidence or may suggest that the mechanism of formation of the polyynes in the carbon arc is the same as that occurring in the surroundings of carbon-rich stars.