Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Incidence and adjacency matrices will have plus or minus one depending on whether vertices lead to other vertices or are adjacent. What you want is to make a complete graph, and then label the edges, I think.

The TSP solver assumes you have weighted edges already. See that documentation for ways to either add edges one by one, or you can separately use add_edge_label. In any case, you'll have to probably take your matrix and programmatically use those values to set the edge labels. Probably by going through the columns, and then through the rows in each column - but watch out, since such a matrix had better be symmetric, so you only need the first i-1 entries of the ith column, I suppose!