Skip to content

Commit

Permalink
2023-04-28T10-24-11Z
Browse files Browse the repository at this point in the history
  • Loading branch information
tddschn committed Apr 28, 2023
1 parent 2f276e7 commit 95e3b6a
Show file tree
Hide file tree
Showing 12 changed files with 754 additions and 247 deletions.
9 changes: 5 additions & 4 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,14 +264,15 @@
}

easygraph_multipcoessing_methods_for_paper = {
'betweenness_centrality',
'closeness_centrality',
# 'betweenness_centrality',
# 'closeness_centrality',
'constraint',
'hierarchy',
# 'hierarchy',
}

easygraph_multiprocessing_n_workers_options = [2, 4, 8]
easygraph_multiprocessing_n_workers_options_for_paper = [2, 4]
# easygraph_multiprocessing_n_workers_options_for_paper = [2, 4]
easygraph_multiprocessing_n_workers_options_for_paper = [2, 4, 8]
dataset_homepage_mapping = {
'cheminformatics': 'https://networkrepository.com/ENZYMES-g1.php',
'bio': 'https://networkrepository.com/bio-yeast.php',
Expand Down
244 changes: 228 additions & 16 deletions profile_easygraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import easygraph as eg
import easygraph
# from easygraph import * # type: ignore
from easygraph import Dijkstra, pagerank, strongly_connected_components, read_edgelist, multi_source_dijkstra, k_core, betweenness_centrality, closeness_centrality, connected_components, connected_components_directed
from easygraph import Dijkstra, pagerank, strongly_connected_components, read_edgelist, multi_source_dijkstra, k_core, betweenness_centrality, closeness_centrality, connected_components, connected_components_directed, clustering, constraint


from benchmark import benchmark_autorange
Expand Down Expand Up @@ -80,16 +80,30 @@ def get_args():
print()


# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then use python version of graph



# 'read_edgelist(filename, delimiter="\t", nodetype=int, create_using=eg.DiGraph()).cpp()' contains quotes
avg_times |= {'loading': benchmark_autorange('read_edgelist(filename, delimiter="\t", nodetype=int, create_using=eg.DiGraph()).cpp()', globals=globals(), n=n) }


# 'read_edgelist(filename, delimiter="\t", nodetype=int, create_using=eg.DiGraph())' contains quotes
avg_times |= {'loading': benchmark_autorange('read_edgelist(filename, delimiter="\t", nodetype=int, create_using=eg.DiGraph())', globals=globals(), n=n) }

# if tool starts with 'constraint' and

# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then convert g back



# loading* only, make g in the globals() so the methods after loading methods can access it.
g = eval('read_edgelist(filename, delimiter="\t", nodetype=int, create_using=eg.DiGraph()).cpp()')

g_py = eval('read_edgelist(filename, delimiter="\t", nodetype=int, create_using=eg.DiGraph())')
g = g_py.cpp()
g_cpp = g



if args.print_graph_info:

Expand All @@ -103,13 +117,12 @@ def get_args():







# networkx & easygraph only, after loading*
from utils import get_first_node
nodeid = 'first_node'
first_node = get_first_node(g)




Expand All @@ -120,12 +133,21 @@ def get_args():
print()


# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then use python version of graph





# 'pagerank(g)' contains quotes
avg_times |= {'page rank': benchmark_autorange('pagerank(g)', globals=globals(), n=n) }

# if tool starts with 'constraint' and

# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then convert g back




Expand All @@ -137,12 +159,21 @@ def get_args():
print()


# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then use python version of graph





# f'Dijkstra(g, {nodeid})' contains quotes
avg_times |= {'shortest path': benchmark_autorange(f'Dijkstra(g, {nodeid})', globals=globals(), n=n) }

# if tool starts with 'constraint' and

# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then convert g back




Expand All @@ -154,12 +185,21 @@ def get_args():
print()


# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then use python version of graph





# 'betweenness_centrality(g)' contains quotes
avg_times |= {'betweenness centrality': benchmark_autorange('betweenness_centrality(g)', globals=globals(), n=n) }

# if tool starts with 'constraint' and

# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then convert g back




Expand All @@ -171,12 +211,167 @@ def get_args():
print()


# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then use python version of graph





# 'closeness_centrality(g)' contains quotes
avg_times |= {'closeness centrality': benchmark_autorange('closeness_centrality(g)', globals=globals(), n=n) }

# if tool starts with 'constraint' and

# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then convert g back






# ===========================
print(f"""Profiling \033[92mclustering\033[0m on dataset \033[34m{filename}\033[0m""")
print("=================")
print()


# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then use python version of graph





# 'clustering(g)' contains quotes
avg_times |= {'clustering': benchmark_autorange('clustering(g)', globals=globals(), n=n) }

# if tool starts with 'constraint' and

# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then convert g back






# ===========================
print(f"""Profiling \033[92mconstraint\033[0m on dataset \033[34m{filename}\033[0m""")
print("=================")
print()


# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then use python version of graph

g = g_py





# 'constraint(g)' contains quotes
avg_times |= {'constraint': benchmark_autorange('constraint(g)', globals=globals(), n=n) }

# if tool starts with 'constraint' and

# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then convert g back

g = g_cpp






# ===========================
print(f"""Profiling \033[92mconstraint-2-workers\033[0m on dataset \033[34m{filename}\033[0m""")
print("=================")
print()


# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then use python version of graph

g = g_py





# 'constraint(g, n_workers=2)' contains quotes
avg_times |= {'constraint-2-workers': benchmark_autorange('constraint(g, n_workers=2)', globals=globals(), n=n) }

# if tool starts with 'constraint' and

# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then convert g back

g = g_cpp






# ===========================
print(f"""Profiling \033[92mconstraint-4-workers\033[0m on dataset \033[34m{filename}\033[0m""")
print("=================")
print()


# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then use python version of graph

g = g_py





# 'constraint(g, n_workers=4)' contains quotes
avg_times |= {'constraint-4-workers': benchmark_autorange('constraint(g, n_workers=4)', globals=globals(), n=n) }

# if tool starts with 'constraint' and

# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then convert g back

g = g_cpp






# ===========================
print(f"""Profiling \033[92mconstraint-8-workers\033[0m on dataset \033[34m{filename}\033[0m""")
print("=================")
print()


# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then use python version of graph

g = g_py





# 'constraint(g, n_workers=8)' contains quotes
avg_times |= {'constraint-8-workers': benchmark_autorange('constraint(g, n_workers=8)', globals=globals(), n=n) }

# if tool starts with 'constraint' and

# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then convert g back

g = g_cpp




Expand All @@ -188,12 +383,21 @@ def get_args():
print()


# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then use python version of graph





# '[i for i in strongly_connected_components(g)]' contains quotes
avg_times |= {'strongly connected components': benchmark_autorange('[i for i in strongly_connected_components(g)]', globals=globals(), n=n) }

# if tool starts with 'constraint' and

# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then convert g back




Expand All @@ -205,35 +409,43 @@ def get_args():
print()


# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then use python version of graph


# remove self loop from graph g before doing k-core



# if tool is easygraph
# remove self loop from graph g before doing k-core


# if tool is easygraph

# give eg access to a python version of Graph first, so that removing self loops is possible
# eval code.removesuffix('.cpp()')

g_og = g
g_python = g.py()
g_python = g_py
g = g_python
g.remove_edges(easygraph.selfloop_edges(g))
g = g.cpp()















# 'k_core(g)' contains quotes
avg_times |= {'k-core': benchmark_autorange('k_core(g)', globals=globals(), n=n) }

# if tool starts with 'constraint' and

# easygraph constraint doesn't have c bindings
# if method starts with 'constraint', then convert g back




Expand Down
Loading

0 comments on commit 95e3b6a

Please sign in to comment.