Skip to content

Commit

Permalink
test script for graph matching
Browse files Browse the repository at this point in the history
  • Loading branch information
Sancar Adali committed May 8, 2018
1 parent 149cce3 commit f47d529
Showing 1 changed file with 69 additions and 0 deletions.
69 changes: 69 additions & 0 deletions test/testGraphM.R
Original file line number Diff line number Diff line change
@@ -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)

}

}

0 comments on commit f47d529

Please sign in to comment.