#!/bin/sh
# Remove duplicate edges from the .adj format
# Send new .adj to stdout

# number of vertices
head -1 $1 | awk '{printf "%d ", $1}'

# number of edges when duplicate edges are removed
cat $1 | awk '{if (NR > 1) print}' | sort | uniq | wc | awk '{print $1}'

# list non-duplicate edges
cat $1 | awk '{if (NR > 1) print}' | sort | uniq 
