public static List<Edge> kruskal(Node node) {
		Map<Node, Integer> m1=new HashMap<>();
		Map<Integer, Node> m2=new HashMap<>();
		Queue<Edge> pq=new PriorityQueue<>((a, b)->(a.w-b.w));
		List<Node> list=bfsHelper(node, pq);
		int i=0;
		for(Node c:list) {
			m1.put(c, i);
			m2.put(i++, c);
		}
		
		UnionFind uf=new UnionFind(list.size());
		List<Edge> rel=new ArrayList<>();
		for (int ct=0; ct<list.size()&&!pq.isEmpty();) {
			Edge e=pq.poll();
			Node a=e.a, b=e.b;
			int x=m1.get(a), y=m1.get(b);
			if (uf.findSet(x)!=uf.findSet(y)) {
				++ct;
				uf.union(x, y);
				rel.add(e);
			}
		}
		
		return rel;
	}