Characterization of graphs with exactly two non