Generate a weighted graph and an adjacency matrix from an image matrix
Ältere Kommentare anzeigen
Hello every one,
i have a image matrix and i want from this matrix, generate a weighted graph G=(V,E) wich V is the vertex set and E is the edge set, for finaly obtain the adjacency matrix. and i don't know how??
thank you in advance.
8 Kommentare
Guillaume
am 21 Mai 2015
a graph of what?
Walter Roberson
am 21 Mai 2015
"Graph" is being used in the sense of Graph Theory.
Is the image one in which a graph has been drawn, and you want to extract the information? A sample would help.
Guillaume
am 21 Mai 2015
Yes, I understood that the graph is in the sense of Graph Theory. There's no obvious link between a graph and an unspecified image unless as you say the question is about extracting the graph from an image of a graph.
Mourchid
am 21 Mai 2015
Mourchid
am 21 Mai 2015
Right, you have the algorithm fairly well explained, so what is your particular problem with generating the graph?
I'll note though that for any image of reasonable size, this algorithm is going to create a very large adjacency matrix. The number of elements in the adjacency matrix is going to be (image width * image height) ^ 2. An image of size 100 x 100 will result in an adjacency matrix around 800 MB.
Rishabh Ramteke
am 29 Okt. 2019
Can you tell me from which paper did you take the above mentioned algorithm?
Akzeptierte Antwort
Weitere Antworten (1)
Thorsten
am 21 Mai 2015
If you have a image matrix like
10 3 4
12 5 8
you could interpret it as an adjacency matrix of a directed graph a follows
vertex 1 2 3
1 10 3 4
2 12 5 8
there is an edge from 1 to 1 weighted 10
1 2 weighted 12
2 to 1 weighted 3
2 2 5
3 to 1 4
3 2 8
Of course you could also interpret the directions the other way round, like from 2 to 1 weighted 12, from 1 to 2 weighted 3 etc.
3 Kommentare
Thorsten
am 21 Mai 2015
I is already your adjacency matrix.
To plot the graph, you need to define the xy coordinates of the nodes and then you can use the gplot command or wgplot.
Kategorien
Mehr zu Convert Image Type finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

