import networkx as nx from openGraphMatching import NeuralMatcher from openGraphMatching.utils import convert_graph from openGraphMatching.utils import check_match_correctness import sys G = convert_graph('./dataset/validate/data_graph/HPRD.graph') # q = convert_graph('./dataset/validate/query_graph/query_dense_16_6.graph') q = convert_graph('./dataset/validate/query_graph/query_dense_16_1.graph') neuralmatch = NeuralMatcher(G) data = neuralmatch.is_subgraph_match(q) matchlist = data[1] f = open("matchlist.data", "w") for i in matchlist: f.write(str(i)) f.write('\n') f.close() flag = True for m in matchlist: if check_match_correctness(q, G, m) == False: flag = False if flag: print('OK! It seems that every match is right') else: print('No!, i got something wrong')
import os.path as osp import networkx as nx import sys import random from openGraphMatching.utils import convert_graph, check_match_correctness, draw_graph from openGraphMatching.matcher import GQLMatcher, CECIMatcher dataset = 'validate' path = osp.join(osp.dirname(osp.realpath(__file__)), '../dataset', dataset) datasetpath = path + '/query_graph/' G = convert_graph(path + '/data_graph/HPRD.graph') of = open('generated_ans.res', 'w') matcher = GQLMatcher(G) query_prefix = 'query_dense_16_' # sample = random.sample(range(1,201), 20) # print(sample) # for i in sample: for i in range(1, 201): query_name = query_prefix + str(i) query_path = query_name + '.graph' print(query_path) q = convert_graph(datasetpath + query_path) # data = matcher.is_subgraph_match(q) imd1 = matcher.LDF(q) imd2 = matcher.NLF(q, imd1) # of.write(f'{query_path}:{len(data[1])}\n') # print('Filtering rate is', data[0])
import os.path as osp import networkx as nx import sys import random from openGraphMatching.utils import convert_graph, check_match_correctness, draw_graph from openGraphMatching.matcher import GQLMatcher, CECIMatcher dataset = 'wordnet' path = osp.join(osp.dirname(osp.realpath(__file__)), '../dataset', dataset) datasetpath = path + '/query_graph/' G = convert_graph(path + '/data_graph/wordnet.graph') # of = open('generated_ans.res', 'w') matcher = GQLMatcher(G) query_prefix = 'query_dense_16_' # sample = random.sample(range(1,201), 20) # print(sample) # for i in sample: for i in range(1, 201): query_name = query_prefix + str(i) query_path = query_name + '.graph' print(query_path) q = convert_graph(datasetpath + query_path) # data = matcher.is_subgraph_match(q) imd1 = matcher.LDF(q) # imd2 = matcher.NLF(q, imd1) # of.write(f'{query_path}:{len(data[1])}\n') # print('Filtering rate is', data[0])