Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Fize Jacques
GMatch4py
Commits
f9fc6da5
Commit
f9fc6da5
authored
Feb 20, 2019
by
Fize Jacques
Browse files
DEBUG MultiDiGraph issue
parent
c1bfdd5e
Changes
2
Hide whitespace changes
Inline
Side-by-side
gmatch4py/graph.pyx
View file @
f9fc6da5
...
...
@@ -39,7 +39,7 @@ cdef class Graph:
self
.
edge_attr_key
=
edge_attr_key
self
.
edges_attr_list
=
[
attr_dict
[
edge_attr_key
]
for
attr_dict
in
self
.
attr_edges
]
self
.
unique_edge_attr_vals
=
set
(
self
.
edges_attr_list
)
# NODE Information init
#######################
...
...
@@ -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
:
...
...
@@ -122,9 +121,10 @@ cdef class Graph:
self
.
edges_hash_idx
[
hash_
]
=
ix
self
.
edges_hash
.
append
(
hash_
)
self
.
edges_hash_set
=
set
(
self
.
edges_hash
)
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
...
...
test/gmatch4py_performance_test.py
0 → 100644
View file @
f9fc6da5
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment