Template for weighted graph (Bi-directional)
class Solution {\n    \n    public int minCost(int maxTime, int[][] edges, int[] passingFees) {\n        //template for bidirectional wieghted graph\n        Ha
class Solution {\n    \n    public int minCost(int maxTime, int[][] edges, int[] passingFees) {\n        //template for bidirectional wieghted graph\n        HashMap<Integer,ArrayList<pair>> map=new HashMap<>();\n        for(int i=0;i<edges.length;i++){\n            int a=edges[i][0];\n            int b=edges[i][1];\n            int c=edges[i][2];\n            if(!map.containsKey(a)){\n                map.put(a,new ArrayList<>());\n            }\n            if(!map.containsKey(b)){\n                map.put(b,new ArrayList<>());\n            }\n            ArrayList<pair> list1=map.get(a);\n            pair np1=new pair(b,c);\n            list1.add(np1);\n            map.put(a,list1);\n            ArrayList<pair> list2=map.get(b);\n            pair np2=new pair(a,c);\n            list2.add(np2);\n            map.put(b,list2);\n        }\n       return 0;\n    }\n}\n\n\tclass pair{\n\t\tint node;\n\t\tint val;\n\t\tpair(int node,int val){\n\t\t\tthis.node=node;\n\t\t\tthis.val=val;\n\t\t}\n}
[]