From 6e1c2d7e9afac9a6efd6dd1ba6cf6052c8e731a4 Mon Sep 17 00:00:00 2001 From: sajadabvi <61247228+sajadabvi@users.noreply.github.com> Date: Wed, 21 Feb 2024 03:45:28 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20neuroneu?= =?UTF-8?q?ral/gunfolds@308da189e976212bbcb5d6b059a25e78fe6aa8be=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/_modules/gunfolds/conversions.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/_modules/gunfolds/conversions.html b/docs/_modules/gunfolds/conversions.html index 605c5082..e971e47f 100644 --- a/docs/_modules/gunfolds/conversions.html +++ b/docs/_modules/gunfolds/conversions.html @@ -1212,6 +1212,29 @@

Source code for gunfolds.conversions

     s += ':- directed(X,Y,U), scc(X,K), scc(Y,L), K != L, sccsize(L,Z), Z > 1, not dag(K,L,N), u(U,N).'
     return s
+ +def Glag2CG(results): + """Converts lag graph format to gunfolds graph format, + and A and B matrices representing directed and bidirected edges weights. + + Args: + results (dict): A dictionary containing: + - 'graph': A 3D NumPy array of shape [N, N, 2] representing the graph structure. + - 'val_matrix': A NumPy array of shape [N, N, 2] storing edge weights. + + Returns: + tuple: (graph_dict, A_matrix, B_matrix) + """ + + graph_array = results['graph'] + bidirected_edges = np.where(graph_array == 'o-o', 1, 0).astype(int) + directed_edges = np.where(graph_array == '-->', 1, 0).astype(int) + + graph_dict = adjs2graph(np.transpose(directed_edges[:, :, 1]), np.transpose((bidirected_edges[:, :, 0]))) + A_matrix = results['val_matrix'][:, :, 1] + B_matrix = results['val_matrix'][:, :, 0] + + return graph_dict, A_matrix, B_matrix