I'm trying to create a workaround for what seems to be a bug in MMA's graph functions related to edge weights:
According to MMA's documentation for MorphologicalGraph:
For EdgeWeight->Automatic the weight of each edge is set to the number of pixels in the corresponding skeleton connection. If more than one connection exists, the shortest one is chosen to represent the weight of the edge.
However, looking at the AdjacencyGraph, it seems to always fill in 0's and 1's, so I assume this not to be working.
What I am looking for can be illustrated with the following code:
img = Import["http://i.stack.imgur.com/Z6RtX.png"]
g = MorphologicalGraph[img, EdgeWeight -> Automatic]
(ColorNegate@ ImageAdjust@ SkeletonTransform@img)~MinFilter~2.~Colorize~(ColorFunction -> "SunsetColors")
This last image shows that it is possible to compute the edge weights using SkeletonTransform, and I assume these to be the ones that MorphologicalGraph is supposed to return.
How can I get the corresponding edge weights in the graph (or, for example as an AdjacencyMatrix), that corresponds to the pixelwidth of each edge in the image?
How can I visualize these graph weights as thickened coloured edges so that a GraphPlot corresponds to the coloured image above?