diplomat.utils.graph_ops.to_valid_graph

diplomat.utils.graph_ops.to_valid_graph(g: ndarray) ndarray[source]

Convert an arbitrary adjacency matrix to a valid undirected graph. Diagonal is set to positive infinity and graph is made symmetric by copying the lower triangle of the graph to the upper triangle.