From 0fa78e4b3b30163d8ac4a770c54beb68544b7b67 Mon Sep 17 00:00:00 2001 From: krahets Date: Wed, 15 Feb 2023 21:45:35 +0800 Subject: [PATCH] Update graph_adjacency_list.java, .cs --- codes/csharp/chapter_graph/graph_adjacency_list.cs | 2 +- codes/csharp/include/Vertex.cs | 4 +++- codes/java/chapter_graph/graph_adjacency_list.java | 3 +-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/codes/csharp/chapter_graph/graph_adjacency_list.cs b/codes/csharp/chapter_graph/graph_adjacency_list.cs index c199bcf8..db76edac 100644 --- a/codes/csharp/chapter_graph/graph_adjacency_list.cs +++ b/codes/csharp/chapter_graph/graph_adjacency_list.cs @@ -12,7 +12,7 @@ namespace hello_algo.chapter_graph; /* 基于邻接表实现的无向图类 */ class GraphAdjList { - // 邻接表 adjList 中的元素是 Vertex 对象 + // 邻接表,key: 顶点,value:该顶点的所有邻接结点 Dictionary> adjList; /* 构造函数 */ diff --git a/codes/csharp/include/Vertex.cs b/codes/csharp/include/Vertex.cs index 954c0e8b..ac64d1b6 100644 --- a/codes/csharp/include/Vertex.cs +++ b/codes/csharp/include/Vertex.cs @@ -4,8 +4,10 @@ * Author: zjkung1123 (zjkung1123@gmail.com), krahets (krahets@163.com) */ +namespace hello_algo.include; + /* 顶点类 */ -class Vertex +public class Vertex { public int Val { get; init; } public Vertex(int val) diff --git a/codes/java/chapter_graph/graph_adjacency_list.java b/codes/java/chapter_graph/graph_adjacency_list.java index 481fa7b9..4f7c071e 100644 --- a/codes/java/chapter_graph/graph_adjacency_list.java +++ b/codes/java/chapter_graph/graph_adjacency_list.java @@ -11,8 +11,7 @@ import include.*; /* 基于邻接表实现的无向图类 */ class GraphAdjList { - // 邻接表,使用哈希表来代替链表,以提升删除边、删除顶点的效率 - // 请注意,adjList 中的元素是 Vertex 对象 + // 邻接表,key: 顶点,value:该顶点的所有邻接结点 Map> adjList; /* 构造方法 */