From e2e85c5301fe7879877b98fe528eef3e8a99b893 Mon Sep 17 00:00:00 2001 From: 645c6305168b7e02f64e7bc9 <645c6305168b7e02f64e7bc9@devide> Date: Fri, 26 May 2023 09:27:00 +0000 Subject: [PATCH] Fri May 26 09:27:00 UTC 2023 inscode --- src/api.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/api.js b/src/api.js index 7443245..6d8cc52 100644 --- a/src/api.js +++ b/src/api.js @@ -1,2 +1,12 @@ +// 假设你已有了邻接矩阵 adjacencyMatrix +// 定义一个二维数组 edges 用来表示各个元素之间的关系(有关系的就标记为 1,否则为 0) +const edges = []; +for (let i = 0; i < adjacencyMatrix.length; i++) { + edges[i] = []; + for (let j = 0; j < adjacencyMatrix[i].length; j++) { + edges[i][j] = adjacencyMatrix[i][j] === 0 ? 0 : 1; + } +} +console.log(edges); // 输出 edges 数组来检查结果 export const apiKey = process.env.INSCODE_API_KEY; export const apiUrl = 'https://inscode-api.csdn.net/api/v1/gpt/'; \ No newline at end of file -- GitLab