public class QFNetwork
extends java.lang.Object
Constructor and Description |
---|
QFNetwork(int N)
Create an initially unconnected network consisting of N nodes (aka sites)
|
Modifier and Type | Method and Description |
---|---|
boolean |
connected(int p,
int q) |
int |
count() |
int |
find(int p) |
static void |
main(java.lang.String[] args) |
void |
union(int p,
int q)
Indicate that nodes p and q are connected in the network
|
public QFNetwork(int N)
N
- the number of nodes in the networkpublic boolean connected(int p, int q)
p
- indicates a node in the networkq
- indicates a node in the networkpublic int count()
public int find(int p)
p
- indicates a node in the networkpublic void union(int p, int q)
p
- indicates a node in the networkq
- indicates a node in the networkpublic static void main(java.lang.String[] args)