In Gplots, draw PNG gplot applies incorrect edge label?

I’m experimenting with drawing PNG images of graphs. All is well except that when I attempt to use edge weights as edge labels, all the correct weight values appear in the image, but they are on the wrong edges.

As I create the edges (iter) I create a random value for the weight, add the edge to the graph and then push the weight onto the end of a vector. This vector is then passed to the gplot function for the edgelabel to use.

G.weights shows the correct weights and consistently reports back the right numbers, so it is just the way that the entries are ordered in the vector supplied to the gplot that is the issue.

Any hints? I have tried fully implementing the weights and then digging into the weights matrix for values, but same result.

Problem solved. I failed to sort my combinations after generation.

I thought I had it, but repeated testing shows that I still have a problem somewhere. The first element seems to be consistently correct, but the remaining elements, while the adjacency matrix is good, do not transfer reliably to the correct edge on the plot. I’ll keep working it and will post an issue if I can’t find the reason for this odd result.

I have opened issue #192 in Graphplots at Edgelabels attached to the wrong edges · Issue #192 · JuliaGraphs/GraphPlot.jl · GitHub with sample code.

@hdperez contributed an alteration to my code in the above link which resolved my issue.