find and eliminate nodes with single input and output edge by connecting neighbors directly