Question: In Python 3 please Question Prompt (1 of 1) suppose we have some input data describing a graph of relationships between parents and children over
Question Prompt (1 of 1) suppose we have some input data describing a graph of relationships between parents and children over multiple generations. The data is formatted as a list of (parent, child) pairs, where each individual is assigned a unique integer identifier. For example, in this diagram, 3 is a child of 1 and 2, and 5 is a child of 4: 3 5 8 Given two individuals in our dataset, write a function that outputs "true" if and only if they share at least one ancestor and "false if they do not. The pair of individuals to query will be provided first, followed by a list of parent-child pairs Example input 3 8 1 3 2 3 3 6 5 6 5 7 4 5 Example output false Clarifications The method still returns true if there are multiple shared ancestors . The IDs are not guaranteed to be contiguous * There are no cycles in the input. . The two inputs will not be the same value . The two individuals are not necessarily the same number of generations away from the shared ancestor A person is not considered to be their own ancestor. If e
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
