subject

The goal of this problem is to cover all roads with cameras. A camera placed at a station can cover all the roads connected to it. For example, if we place a camera at station 0, the roads (or edges) (0,3) and (0,8) are covered. Note: the edges (0,3) and (3,0) are the same. We want to find all solutions that can cover a network. For example, one solution is to place a camera at each station will cover all roads. In G2, which has 10 stations, this solution is the set {0,1,2,3,4,5,6,7,8,9} or [True, True, True, True, True, True, True True, True, True). Another solution for G2 is {2, 3, 5, 8} or [False, False, True, True, False, True, False, False, True, False, False]. Any road/edge in G2 is connected to one of these 2 or 3 or 5 or 8. Therefore, {2,3,5, 8} is one of the solutions we look for. The code below is almost complete in printing out all solutions, i. e. sets of stations that cover an entire network. What you need to do for this problem is modyfing the is_coverage function, which returns True if the solution is a coverage, and False if it is not. At this time, it's just a placeholder, which always returns True. This is obviously incorrect. You need to fix it. [42]: def is_coverage (solution, G): return True def get_stations(s): return set([i for i in range(len(s)) if s[i]==True]) def cover(G, solution, i): if i==len(solution): if is_coverage (solution, G): print(get_stations ( solution)) else: solution[i] = True cover(G, solution, i+1) solution[i] = False cover(G, solution, i+1)

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:40
Assume that there is a 4% rate of disk drive failure in a year. a. if all your computer data is stored on a hard disk drive with a copy stored on a second hard disk drive, what is the probability that during a year, you can avoid catastrophe with at least one working drive? b. if copies of all your computer data are stored on three independent hard disk drives, what is the probability that during a year, you can avoid catastrophe with at least one working drive?
Answers: 1
question
Computers and Technology, 22.06.2019 21:00
So im doing this school challenge and the teachers said whats the average text a student gets a day so i need to get about 20 in a day but dont know how can you guys 2163371293
Answers: 2
question
Computers and Technology, 23.06.2019 09:30
:you areto design the controller for alight that functions both as an ordinary light and also as a motion activated light and alarm. a.if the manual switch s is on, then the light l is on. b.besides the manual switch, there is a motion detector, m1, which activatesthis light.c.if motion is detected but the light is on anyway because s is on, only then a secondoutput a, an alarm, is turned on. d.the disable switch, d, disables the motion activated light and alarmbut leaves manual control operation of the light using switch s.(i)read the problem statement and clearly identify the inputs and outputs for the circuit you are designing. (ii)create the truth table for this system; include the light, alarm, switch, disable, and the motion sensor.(iii)draw a schematic of this system.
Answers: 1
question
Computers and Technology, 23.06.2019 12:30
What is the difference between the internet and the world wide web?
Answers: 1
You know the right answer?
The goal of this problem is to cover all roads with cameras. A camera placed at a station can cover...
Questions
question
Mathematics, 16.09.2019 11:30
question
Social Studies, 16.09.2019 11:30
Questions on the website: 13722362