閱碼場(chǎng) 第3期:Ftrace訓(xùn)練營(yíng)
2022-10-16 20:09 作者:三國(guó)盡歸許佳琪 | 我要投稿
? // 1. construct adjacency list
? ? ? ?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)簽: