老男孩 Python數(shù)據(jù)分析機(jī)器學(xué)習(xí)
? ? Map<Integer, List<Integer>> adjacencyList = new HashMap<>();
? ? ? ?for (int i = 0; i < nodeNum; i++) {
? ? ? ? ? ?adjacencyList.put(i, new ArrayList<>());
? ? ? ?}
? ? ? ?for (int i = 0; i < edges.length; i++) {
? ? ? ? ? ?int u = edges[i][0];
? ? ? ? ? ?int v = edges[i][1];
? ? ? ? ? ?adjacencyList.get(u).add(v);
? ? ? ? ? ?adjacencyList.get(v).add(u);
? ? ? ?}
標(biāo)簽: