Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
342 views
in Technique[技术] by (71.8m points)

data structures - Represent multipart weighted graph using adjacency matrix

I was going through the adjacency matrix in graph data structures. I have seen some examples representing the degree of a vertex in the adjacency matrix and some representing the weight of edges in the adjacency matrix but I was curious if we could represent multigraph weighted edges in the adjacency matrix? It seems quite impossible. I tried googling but any help is greatly appreciated.

Look at the below image consisting of multigraph weighted edges. How could we represent this using an adjacency matrix, if not an adjacency matrix is there any other way of representing in a matrix or other structure?

enter image description here

question from:https://stackoverflow.com/questions/65863096/represent-multipart-weighted-graph-using-adjacency-matrix

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You could do it by storing a list of weights in each cell of the adjacency matrix, instead of just the one integer.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...