Geno’s solution applies if the setup instructions restrict a computer to one graphic device at a time and allows a computer to be disconnected from all graphic devices.
The set up in the question requires a computer connection to at least one peripheral graphics device and allows for more than one connection. The peripheral graphics device require at least one connection to a computer and allows for more than one connection. Because of the bidirectional nature of this communication, if a computer is connected to a peripheral, the peripheral is also connected to the computer. This may seem obvious but the connection requirements would not work if this were not so.
This kind of software is usually installed in a print server. The computers poll the peripherals to find the status and the peripherals broadcast their status to the computers. Similar software controls network connections. The connection protocols are relatively trivial, while the algorithms that optimize the routing hops through nodes are complex and intricate. The solution to this is found using this formula. N = number of computers and k = number of peripheral graphics devices.
$$\displaystyle \sum \limits_{i=0}^{\textcolor[rgb]{1,0,0}{N-1}} *(-1)^i*\binom{N}{i}* (N-i)^k \hspace{15pt}| \hspace{15pt} \Text {N=19 \; k=23} \\\$$
Wolfram Alpha: scripted link
https://www.wolframalpha.com/input /?i=sum+%28+binom%2819%2Ci%29*%28-1%29^i*%2819-i%29^23%29+from+i%3D0+to+18
Script
sum (binom(19,i)*(-1)^i*(19-i)^23) from i=0 to 18
This result equals the one presented in your book.