Unverified Commit b569e4be authored by Mingbang Wang's avatar Mingbang Wang Committed by GitHub
Browse files

[Misc] Correct some typos (#7120)

parent 458b938c
...@@ -98,11 +98,12 @@ def random_homo_graphbolt_graph( ...@@ -98,11 +98,12 @@ def random_homo_graphbolt_graph(
) )
edges = np.stack([nodes, neighbors], axis=1) edges = np.stack([nodes, neighbors], axis=1)
os.makedirs(os.path.join(test_dir, "edges"), exist_ok=True) os.makedirs(os.path.join(test_dir, "edges"), exist_ok=True)
assert edge_fmt in ["numpy", "csv"], print( assert edge_fmt in [
"only numpy and csv are supported for edges." "numpy",
) "csv",
], "Only numpy and csv are supported for edges."
if edge_fmt == "csv": if edge_fmt == "csv":
# Wrtie into edges/edge.csv # Write into edges/edge.csv
edges_DataFrame = pd.DataFrame(edges, columns=["src", "dst"]) edges_DataFrame = pd.DataFrame(edges, columns=["src", "dst"])
edge_path = os.path.join("edges", "edge.csv") edge_path = os.path.join("edges", "edge.csv")
edges_DataFrame.to_csv( edges_DataFrame.to_csv(
...@@ -111,7 +112,7 @@ def random_homo_graphbolt_graph( ...@@ -111,7 +112,7 @@ def random_homo_graphbolt_graph(
header=False, header=False,
) )
else: else:
# Wrtie into edges/edge.npy # Write into edges/edge.npy
edges = edges.T edges = edges.T
edge_path = os.path.join("edges", "edge.npy") edge_path = os.path.join("edges", "edge.npy")
np.save(os.path.join(test_dir, edge_path), edges) np.save(os.path.join(test_dir, edge_path), edges)
...@@ -160,7 +161,7 @@ def random_homo_graphbolt_graph( ...@@ -160,7 +161,7 @@ def random_homo_graphbolt_graph(
yaml_content = f""" yaml_content = f"""
dataset_name: {dataset_name} dataset_name: {dataset_name}
graph: # graph structure and required attributes. graph: # Graph structure and required attributes.
nodes: nodes:
- num: {num_nodes} - num: {num_nodes}
edges: edges:
...@@ -219,7 +220,7 @@ def random_homo_graphbolt_graph( ...@@ -219,7 +220,7 @@ def random_homo_graphbolt_graph(
return yaml_content return yaml_content
def genereate_raw_data_for_hetero_dataset( def generate_raw_data_for_hetero_dataset(
test_dir, dataset_name, num_nodes, num_edges, num_classes, edge_fmt="csv" test_dir, dataset_name, num_nodes, num_edges, num_classes, edge_fmt="csv"
): ):
# Generate edges. # Generate edges.
...@@ -229,9 +230,10 @@ def genereate_raw_data_for_hetero_dataset( ...@@ -229,9 +230,10 @@ def genereate_raw_data_for_hetero_dataset(
src = torch.randint(0, num_nodes[src_ntype], (num_edge,)) src = torch.randint(0, num_nodes[src_ntype], (num_edge,))
dst = torch.randint(0, num_nodes[dst_ntype], (num_edge,)) dst = torch.randint(0, num_nodes[dst_ntype], (num_edge,))
os.makedirs(os.path.join(test_dir, "edges"), exist_ok=True) os.makedirs(os.path.join(test_dir, "edges"), exist_ok=True)
assert edge_fmt in ["numpy", "csv"], print( assert edge_fmt in [
"only numpy and csv are supported for edges." "numpy",
) "csv",
], "Only numpy and csv are supported for edges."
if edge_fmt == "csv": if edge_fmt == "csv":
# Write into edges/edge.csv # Write into edges/edge.csv
edges = pd.DataFrame( edges = pd.DataFrame(
...@@ -290,7 +292,7 @@ def genereate_raw_data_for_hetero_dataset( ...@@ -290,7 +292,7 @@ def genereate_raw_data_for_hetero_dataset(
yaml_content = f""" yaml_content = f"""
dataset_name: {dataset_name} dataset_name: {dataset_name}
graph: # graph structure and required attributes. graph: # Graph structure and required attributes.
nodes: nodes:
- type: user - type: user
num: {num_nodes["user"]} num: {num_nodes["user"]}
......
...@@ -2713,7 +2713,7 @@ def test_OnDiskDataset_heterogeneous(include_original_edge_id, edge_fmt): ...@@ -2713,7 +2713,7 @@ def test_OnDiskDataset_heterogeneous(include_original_edge_id, edge_fmt):
("user", "click", "item"): 20000, ("user", "click", "item"): 20000,
} }
num_classes = 10 num_classes = 10
gbt.genereate_raw_data_for_hetero_dataset( gbt.generate_raw_data_for_hetero_dataset(
test_dir, test_dir,
dataset_name, dataset_name,
num_nodes, num_nodes,
......
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