Skip to content

Commit

Permalink
chore: reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
yizhihenpidehou committed Dec 12, 2023
1 parent e0a612f commit 787f716
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ __pycache__
test/
related-repos/
test.py
dynamic_hypergraph.pdf
hypergraph_tutorial.py
visulation_test.py
hypergraph-bench/
Expand Down
5 changes: 0 additions & 5 deletions easygraph/datasets/hospital_lyon.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def preprocess(self, data, max_order=None, is_dynamic=True):
cols = []
edge_flag_dict = {}
edge_id = 0
print("len data[edge-dict].items():", len(data["edge-dict"].items()))
for id, edge in data["edge-dict"].items():
if max_order and len(edge) > max_order + 1:
continue
Expand All @@ -69,10 +68,6 @@ def preprocess(self, data, max_order=None, is_dynamic=True):

try:
edge = [name_dict[n] for n in edge]
# if tuple(edge) not in edge_flag_dict:
# print("edge:",edge)
# print("edge_id:",edge_id)
# edge_flag_dict[tuple(edge)] = 1
rows.extend(edge)
cols.extend(len(edge) * [edge_id])
edge_id += 1
Expand Down
4 changes: 3 additions & 1 deletion easygraph/functions/drawing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def draw_vertex(
font_family: str,
v_size: list,
v_color: list,
edgecolors,
v_line_width: list,
):
patches = []
Expand All @@ -178,7 +179,8 @@ def draw_vertex(
va="top",
)
patches.append(circle)
p = PatchCollection(patches, facecolors=v_color, edgecolors="black")
edgecolors = "black" if edgecolors == None else edgecolors
p = PatchCollection(patches, facecolors=v_color, edgecolors=edgecolors)
ax.add_collection(p)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,16 @@ def uniform_hypergraph_Gnm(k: int, num_v: int, num_e: int, n_workers=None):

with Pool(n_workers) as p:
ret = p.imap(local_function, edges_parallel)
start_time = time.time()
for res in ret:
for r in res:
res_edges.add(r)
# for key in res:
print("res:", len(res_edges))

while len(res_edges) < num_e:
e = random.sample(range(num_v), k)
e = tuple(sorted(e))
if e not in res_edges:
res_edges.add(e)

# res_hypergraph.add_hyperedges(e_list=res)
end_time = time.time()

print("nworker merge time:", end_time - start_time)
# print("res:",res_edges)
res_hypergraph = eg.Hypergraph(num_v=num_v, e_list=list(res_edges))
return res_hypergraph

Expand Down

0 comments on commit 787f716

Please sign in to comment.