Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

For this problem, you are only allowed to use standard python libraries

Computer Science Apr 08, 2021

For this problem, you are only allowed to use standard python libraries. You may not use third-party libraries or call any shell/bash functions.

1 Problem 1

You are given a list of tuples of the form (<float> x, <float> y, <float> r) (let’s call these c-tup/es). Each c-tuple represents a circle on a rectangular coordinate space, with x and y being the coordinates of the center, and r being the radius. Assume that each c-tup/e has a unique radius.

Let a cluster of circles be a group of circles where each circle in the group overlaps with at least one other circle in that group. Formally, first let a path be formed between two circles when they overlap. Define a cluster as a group of n circles, where each circle is reachable from every other circle through the formed paths.

Write a python script that does the following: For each c/uster, the circle with the largest area is kept, and all other circles in that cluster are removed. Return the resulting list of c-tuples. Some examples are shown.

Input: [(0.5, 0.5, 0.5), (1.5, 1.5, 1.1), (0.7, 0.7, 0.4), (4, 4, 0.7)] Input: [(1.5, 1.5, 1.3), (4, 4, 0.7)] Input: [(1, 3, 0.7), (2, 3, 0.4), (3, 3, 0.9)]

_ Output: [(1.5, 1.5, 1.1), (4, 4, 0.7)] Output: [(1.5, 1.5, 1.3), (4, 4, 0.7)] | Output: [(3, 3, 0.9)]

Figure 1: The bottom left circles form a cluster Red circles are removed.

Figure 2: No clusters are found, and no circles are removed.

Figure 3: The three circles form a cluster. Red circles are removed.

 

Archived Solution
Unlocked Solution

You have full access to this solution. To save a copy with all formatting and attachments, use the button below.

Already a member? Sign In
Important Note: This solution is from our archive and has been purchased by others. Submitting it as-is may trigger plagiarism detection. Use it for reference only.

For ready-to-submit work, please order a fresh solution below.

Or get 100% fresh solution
Get Custom Quote
Secure Payment