Advertisement
UriSteiff

test

Jun 17th, 2021
893
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1. public class tester {
  2.  
  3.     public static void main(String[] args){
  4.  
  5.         Graph.Node[] nodes = new Graph.Node[6];
  6.  
  7.         nodes[0] = new Graph.Node(1,12);
  8.         nodes[1] = new Graph.Node(2,2);
  9.         nodes[2] = new Graph.Node(3,4);
  10.         nodes[3] = new Graph.Node(4, 5);
  11.         nodes[4] = new Graph.Node(5, 8);
  12.         nodes[5] = new Graph.Node(6, 10);
  13.  
  14.         Graph g = new Graph(nodes);
  15.        
  16.         g.addEdge(1, 4);
  17.         g.addEdge(1, 5);
  18.         g.addEdge(1, 2);
  19.         g.addEdge(2, 4);
  20.         g.addEdge(2, 5);
  21.         g.addEdge(2, 3);
  22.         g.addEdge(3, 6);
  23.         g.addEdge(4, 6);
  24.         g.addEdge(5, 6);
  25.         for (int i = 1; i <= 6; i++) {
  26.             System.out.println(i + " : " + g.getNeighborhoodWeight(i));
  27.         }
  28.         System.out.println("id of node with max neighbourhood: " + g.maxNeighborhoodWeight().getId());
  29.        
  30.  
  31.        
  32.     }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement