-1

I'm having a hard time conceptually understanding the following question:

A virus has infected your computer lab. If a computer has the virus it can spread to any computer that is not infected. The input, computer_lab, is a 2D array of 1s and 0s representing the computers in the lab.

Example 2D matrix computer_lab input:

1 0 1 0 0 
0 1 0 1 1 
0 1 1 1 0
1 0 0 0 0 
1 1 1 1 1 
  • A 0 at (X,Y) means computer X can't reach computer Y
  • A 1 at (X,Y) means computer X can reach computer Y

Can anyone explain the above statements? How can an ordered pair be used to reference a 2D array? Is this asking to treat the 2D matrix as a graph?

Additionally, if you're given another input, sick_machines, that represents the computers that already have a virus, but the input is given as an array of N integers, what do these integers represent in context of the 2D matrix?

i.e. sick_machines = [2,3,7]

William Merritt
  • 429
  • 1
  • 5
  • 12
  • This question is a little broad, but it looks like they're trying to get at a numpy array which is of the form rows x columns for your ordered pairs. Look into [np.where](https://stackoverflow.com/questions/34667282/numpy-where-detailed-step-by-step-explanation-examples) for your conditions – G. Anderson Oct 17 '18 at 17:22
  • 1
    https://en.wikipedia.org/wiki/Adjacency_matrix – user2357112 Oct 17 '18 at 17:24
  • 1
    I'm voting to close this question as off-topic because the question is in network terminology and reading comprehension, not programming. There are other sites on Stack Exchange where this would fit. Please check ["Which site?"](https://meta.stackexchange.com/questions/129598/which-computer-science-programming-stack-exchange-do-i-post-in). – Prune Oct 17 '18 at 17:25

1 Answers1

0

The 2D array IS a graph. It is not symmetric because computer A can reach computer B but not vice versa. The 0 on the diagonal is interesting because it somehow meant the computer can't reach itself but otherwise it's a clearly formulated problem.

Sick machine would just mean that the index of those computer are infected, and I assume following question would ask how it could spread via the graph, which you can find out in the 2D matrix.

Rocky Li
  • 5,641
  • 2
  • 17
  • 33