From f47d529f6ed9fd9f30cb42e7e0070b88c329739e Mon Sep 17 00:00:00 2001 From: Sancar Adali Date: Tue, 8 May 2018 14:15:38 -0400 Subject: [PATCH] test script for graph matching --- test/testGraphM.R | 69 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 test/testGraphM.R diff --git a/test/testGraphM.R b/test/testGraphM.R new file mode 100644 index 0000000..64e762a --- /dev/null +++ b/test/testGraphM.R @@ -0,0 +1,69 @@ +# //*********************GRAPHS********************************** +# //graph_1,graph_2 are graph adjacency matrices, +# //C_matrix is the matrix of local similarities between vertices of graph_1 and graph_2. +# //If graph_1 is NxN and graph_2 is MxM then C_matrix should be NxM +# graph_1=../test_simple/g s +# graph_2=../test_simple/h s +# C_matrix=../test_simple/null s +# //*******************ALGORITHMS******************************** +# //used algorithms and what should be used as initial solution in corresponding algorithms +# algo=I U RANK QCV rand PATH s +# algo_init_sol=unif unif unif unif unif unif s +# solution_file=solution_im.txt s +# //coeficient of linear combination between (1-alpha_ldh)*||graph_1-P*graph_2*P^T||^2_F +alpha_ldh*C_matrix +# alpha_ldh=0 d +# cdesc_matrix=A c +# cscore_matrix=A c +# //**************PARAMETERS SECTION***************************** +# hungarian_max=10000 d +# algo_fw_xeps=0.01 d +# algo_fw_feps=0.01 d +# //0 - just add a set of isolated nodes to the smallest graph, 1 - double size +# dummy_nodes=0 i +# // fill for dummy nodes (0.5 - these nodes will be connected with all other by edges of weight 0.5(min_weight+max_weight)) +# dummy_nodes_fill=0 d +# // fill for linear matrix C, usually that's the minimum (dummy_nodes_c_coef=0), +# // but may be the maximum (dummy_nodes_c_coef=1) +# dummy_nodes_c_coef=0.01 d +# +# qcvqcc_lambda_M=10 d +# qcvqcc_lambda_min=1e-5 d +# +# +# //0 - all matching are possible, 1-only matching with positive local similarity are possible +# blast_match=1 i +# blast_match_proj=0 i +# +# +# //****************OUTPUT*************************************** +# //output file and its format +# exp_out_file=../test_simple/exp_out_file s +# exp_out_format=Parameters Compact Permutation s +# //other +# debugprint=0 i +# debugprint_file=debug.txt s +# verbose_mode=1 i +# //verbose file may be a file or just a screen:cout +# verbose_file=cout s + + +test_graph_match <- function(A,B,algorithm_params) { + writeMat(A,"./src/graphm/Rpkgtest/testA") + writeMat(B,"./src/graphm/Rpkgtest/testB") + write_config("./src/graphm/Rpkgtest/config.txt",A,B,algorithm_params) + system("./src/graphm/bin/graphm config.txt") +} + +writeMat <- function (A,filepath) { + + writeLines(A,filepath) +} +write_config <- function (filepath,A,B,algo_params){ + writeLines("graph_1=./src/graphm/Rpkgtest/testA",filepath) + writeLines("graph_2=./src/graphm/Rpkgtest/testB",filepath) + for ( par in algo_params) { + writeLines(names(par),'=', par ," " ,"s" ,filepath) + + } + +}