I've a file which stores a directed graph. Each line is represented as
node1 TAB node2 TAB weight
I want to find the set of nodes. Is there a better way of getting union? My current solution involves creating temporary files:
cut -f1 input_graph | sort | uniq > nodes1
cut -f2 input_graph | sort | uniq > nodes2
cat nodes1 nodes2 | sort | uniq > nodes