Question
Please show input/output!! Imagine a graph representing a network of stations (nodes) connecting by roads (edges). If a camera is placed at a node, it
Please show input/output!!
Imagine a graph representing a network of stations (nodes) connecting by roads (edges). If a camera is placed at a node, it can watch all roads connected to it. For example, in the network rg_10_15_2018, a camera placed at station 8 can watch the roads that connect station 8 to stations 3, 4, and 0. In this network, cameras placed at stations 3, 4, 0 and 1 can watch all roads. Therefore, {3, 4, 0, 1} is a camera placement on this network that covers all roads. Again we have a budget of k cameras. For example, k=6. We want the camera to cover as many roads as possible. It is possible we wont be able to cover all roads. Write a Python program, using the backtracking technique we learned, to find the camera placements that cover as many roads as possible.
EACH NODE IS A 'CAMERA', EACH EDGE IS A 'ROAD' WE ARE SUPPOSE TO USE A 'BACK TRACKING ALGORITHM' TO DETERMINE, GIVEN K CAMERAS, HOW MANY ROADS CAN WE WATCH, ASSUMING A NODE(CAMERA) CAN WATCH ALL EDGES(ROADS) CONNECTED TO IT
4 0 4 0
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started