Generate a weighted graph and an adjacency matrix from an image matrix
Mostrar comentarios más antiguos
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 comentarios
Guillaume
el 21 de Mayo de 2015
a graph of what?
Walter Roberson
el 21 de Mayo de 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
el 21 de Mayo de 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
el 21 de Mayo de 2015
Mourchid
el 21 de Mayo de 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
el 29 de Oct. de 2019
Can you tell me from which paper did you take the above mentioned algorithm?
Respuesta aceptada
Más respuestas (1)
Thorsten
el 21 de Mayo de 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 comentarios
Thorsten
el 21 de Mayo de 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.
Categorías
Más información sobre Convert Image Type en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

