Add function to filter redundant pathways.