Une mise-à-jour est prévue le 9 juillet entre 13:00 et 14:00. Le service sera inaccessible ou instable pendant cette période. Merci de votre compréhension.

Commit 970852f0 authored by Fize Jacques's avatar Fize Jacques

Patch BOC

DEBUG Linux setup
parent b970b0e1
......@@ -43,9 +43,11 @@ def nx2nk(nxG, weightAttr=None):
def getClique(nx_graph):
final_cliques=[]
if len(nx_graph) ==0:
if len(nx_graph) ==0 or not nx_graph:
return final_cliques
netkit_graph,idmap=nx2nk(nx_graph)
if not netkit_graph:
return final_cliques
idmap={v:k for k,v in idmap.items()}
cliques=MaximalCliques(netkit_graph).run().getCliques()
for cl in cliques:
......@@ -63,8 +65,9 @@ class BagOfCliques():
cdef double[:,:] scores = np.zeros((n,n))
cdef int i
for i in range(len(scores)):
if not i in selected:
continue
if selected:
if not i in selected:
continue
for j in range(i,len(scores)):
scores[i,j]=(np.dot(bog[i],bog[j]))/(np.sqrt(np.sum(bog[i]**2))*np.sqrt(np.sum(bog[j]**2))) # Can be computed in one line
scores[j,i]=scores[i,j]
......@@ -163,4 +166,9 @@ class BagOfCliques():
if hash in map_str_cliques:
vector[map_str_cliques[hash]] = 1
boc[g] = vector
return boc
\ No newline at end of file
return boc
def distance(self,matrix):
return 1-np.array(matrix)
def similarity(self,matrix):
return np.array(matrix)
\ No newline at end of file
......@@ -10,6 +10,10 @@ except:
print("copy from www.cython.org and install it")
sys.exit(1)
is_linux = sys.platform.system() == 'Linux'
libs=[]
if is_linux: # Issue #42
libs.append('rt') # -lrt for clock_gettime
def scandir(dir, files=[]):
for file in os.listdir(dir):
......@@ -22,18 +26,24 @@ def scandir(dir, files=[]):
# generate an Extension object from its dotted name
def makeExtension(extName):
global libs
extPath = extName.replace(".", os.path.sep)+".pyx"
return Extension(
extName,
[extPath],include_dirs=[np.get_include()],language='c++'
[extPath],include_dirs=[np.get_include()],language='c++',libraries=libs
)
# get the list of extensions
extNames = scandir("gmatch4py")
# and build up the set of Extension objects
extensions = cythonize([makeExtension(name) for name in extNames])
setup(
name="GMatch4py",
description="A module for graph matching",
......@@ -45,7 +55,7 @@ setup(
version="0.1"
)
#Clean cpp and compiled file
f=True
f=False
if f:
if os.path.exists("build"):
shutil.rmtree("build")
......
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