Generating a totally unimodular matrix

313 Views Asked by At

Is there any method to randomly generate a totally unimodular matrix?

Any algorithm or code will be appreciated.

1

There are 1 best solutions below

1
On BEST ANSWER

The adjacency matrix of any bipartite graph is TU. You could randomly generate bipartite graphs using NetworkX, and just take their adjacency matrices. This wouldn't be able to get any TU matrix, but would be a way to easily generate random square TU matrices of arbitrary size.