added graph pruning