public class DegreesOfSeparation extends Object
The running time is proportional to the number of individuals and connections in the network. If the connections are given implicitly, as in the movie network example (where every two actors are connected if they appear in the same movie), the efficiency of the algorithm is improved by allowing both movie and actor vertices and connecting each movie to all of the actors that appear in that movie.
For additional documentation, see Section 4.1 of Algorithms, 4th Edition by Robert Sedgewick and Kevin Wayne.
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args)
Reads in a social network from a file, and then repeatedly reads in
individuals from standard input and prints out their degrees of
separation.
|
public static void main(String[] args)
Copyright © 2025. All Rights Reserved.