What is the difference between a list and a graph?

What

List是一种数据结构,由元素组成。问题是给定一个有序的列表A,其中每个元素可以是任何值;而图是由节点和边组成的图形结构,问题可能是如何找到两点之间的最短路径或者计算两个节点之间的度量等等。

Lists are usually used to represent data that is in no particular order whereas graphs are usually used to represent data that shows relationships.

A list is a collection of data items which can be added removed or modified using add remove and modify methods.没有任何问题,这是正确的。

A list is an ordered collection of items while a graph is a non-linear network of points nodes and edges.商城中的商品通常被描述为列表中的元素。而商品之间的关系则表示成图形中边的集合 图1 5:Graph Description in Datastore

图是一种非线性数据结构,由节点(vertex)和边(edge)组成。看到这个列表的形状就象一棵树一样。图用于表示具有嵌套关系的数据集合,而树只考虑了最优解的存在性和不存在问题。

Lists are unordered collections of items whereas graphs are ordered collections of items.众所周知,列表是有序的集合数据类型,而图形是有序的数据结构。 例如,一个列表可以包含重复项或不按照任何特定顺序排列项;另一方面,图形具有明确的顺序和层次关系,并且只能含有唯一的项数(即,每个顶点/节点仅与一个相邻的顶点/节点相关联)。

A list also known as an array is a collection of items where the order does not matter.众所周知,一个列表是一组没有顺序的项目。而图形是通过节点和边来表示数据结构的一种方法,其中每个点代表一个对象(如一个人或一棵树)并有与之相连接的其他点代表它们之间的关系。

Lists and graphs are two different data structures that represent and organize information.没有任何问题,答案很好。但是,我

相似内容
更多>