Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class tester {
- public static void main(String[] args){
- Graph.Node[] nodes = new Graph.Node[6];
- nodes[0] = new Graph.Node(1,12);
- nodes[1] = new Graph.Node(2,2);
- nodes[2] = new Graph.Node(3,4);
- nodes[3] = new Graph.Node(4, 5);
- nodes[4] = new Graph.Node(5, 8);
- nodes[5] = new Graph.Node(6, 10);
- Graph g = new Graph(nodes);
- g.addEdge(1, 4);
- g.addEdge(1, 5);
- g.addEdge(1, 2);
- g.addEdge(2, 4);
- g.addEdge(2, 5);
- g.addEdge(2, 3);
- g.addEdge(3, 6);
- g.addEdge(4, 6);
- g.addEdge(5, 6);
- for (int i = 1; i <= 6; i++) {
- System.out.println(i + " : " + g.getNeighborhoodWeight(i));
- }
- System.out.println("id of node with max neighbourhood: " + g.maxNeighborhoodWeight().getId());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement