开发者

graphs and their representation as edge lists

开发者 https://www.devze.com 2023-02-05 12:31 出处:网络
I have to represent a graph. how can this be done using edge lists? what is its format开发者_开发百科 actually?Assuming you are talking about adjacency lists . . .

I have to represent a graph. how can this be done using edge lists? what is its format开发者_开发百科 actually?


Assuming you are talking about adjacency lists . . .

If you have a simple triangle where vertices are labeled a, b, and c, then you would use something like this:

a | b, c
b | a, c
c | a, b

Depending on the implementation language, you could use, for example, a Dictionary<string, List<string>> where the key would be the vertex label and the value would be a list of adjacent vertices.

See Wikipedia as well.

0

精彩评论

暂无评论...
验证码 换一张
取 消