Commit f9fc6da5 authored by Fize Jacques's avatar Fize Jacques

DEBUG MultiDiGraph issue

parent c1bfdd5e
......@@ -57,7 +57,6 @@ cdef class Graph:
if self.is_edge_attr:
self.degree_per_attr={attr_v:{n:{"in":0,"out":0} for n in self.nodes_list} for attr_v in self.unique_edge_attr_vals}
self.degree_per_attr_weighted={attr_v:{n:{"in":0,"out":0} for n in self.nodes_list} for attr_v in self.unique_edge_attr_vals}
# Retrieving Degree Information
self.edges_of_nodes={}
for n in self.nodes_list:
......@@ -114,7 +113,7 @@ cdef class Graph:
if not e1 in self.edges_hash_map:self.edges_hash_map[e1]={}
hash_=self.hash_edge_attr(e1,e2,self.edges_attr_list[ix]) if self.is_edge_attr else self.hash_edge(e1,e2)
if self.is_multi:
if self.is_multi and self.is_edge_attr:
if not e2 in self.edges_hash_map[e1]:self.edges_hash_map[e1][e2]={}
self.edges_hash_map[e1][e2][self.edges_attr_list[ix]]=hash_
else:
......@@ -125,6 +124,7 @@ cdef class Graph:
self.edges_weight={}
for e1,e2,attr_dict in list(G.edges(data=True)):
print(e1,e2,attr_dict)
hash_=self.hash_edge_attr(e1,e2,attr_dict[self.edge_attr_key]) if self.is_edge_attr else self.hash_edge(e1,e2)
self.edges_weight[hash_]=attr_dict["weight"] if "weight" in attr_dict else 1
......
from gmatch4py import *
import networkx as nx
import time
from tqdm import tqdm
import pandas as pd
max_=500
size_g=10
graphs_all=[nx.random_tree(size_g) for i in range(max_)]
result_compiled=[]
for size_ in tqdm(range(50,max_,50)):
graphs=graphs_all[:size_]
comparator=None
for class_ in [BagOfNodes,WeisfeleirLehmanKernel,GraphEditDistance, GreedyEditDistance, HED, BP_2 Jaccard, MCS, VertexEdgeOverlap]:
deb=time.time()
if class_ in (GraphEditDistance, BP_2, GreedyEditDistance, HED):
comparator = class_(1, 1, 1, 1)
elif class_ == WeisfeleirLehmanKernel:
comparator = class_(h=2)
else:
comparator=class_()
matrix = comparator.compare(graphs,None)
print([class_.__name__,size_,time.time()-deb])
result_compiled.append([class_.__name__,size_,time.time()-deb])
df=pd.DataFrame(result_compiled,columns="algorithm size_data time_exec_s".split())
df.to_csv("new_gmatch4py_res_{0}graphs_{1}size.csv".format(max_,size_g))
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment