GraphItem takes lists in constructor instead of sets because a set
already removes duplicates and that may be an unwanted side effect.