Skip to content

Commit

Permalink
fix bugs for to_txt for nodes solvers
Browse files Browse the repository at this point in the history
  • Loading branch information
heatingma committed Feb 12, 2025
1 parent 7afb486 commit f46dd70
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ml4co_kit/solver/mcl/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def to_txt(self, file_path: str = "example.txt"):
with open(file_path, "w") as f:
for graph in self.graph_data:
edge_index = graph.edge_index.T
nodes_label = graph.nodes_label
nodes_label = graph.nodes_label.astype(np.int32)
f.write(" ".join(str(src) + str(" ") + str(tgt) for src, tgt in edge_index))
f.write(str(" ") + str("label") + str(" "))
f.write(str(" ").join(str(node_label) for node_label in nodes_label))
Expand Down
2 changes: 1 addition & 1 deletion ml4co_kit/solver/mcut/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ def to_txt(self, file_path: str = "example.txt"):
with open(file_path, "w") as f:
for graph in self.graph_data:
edge_index = graph.edge_index.T
nodes_label = graph.nodes_label
nodes_label = graph.nodes_label.astype(np.int32)
f.write(" ".join(str(src) + str(" ") + str(tgt) for src, tgt in edge_index))
f.write(str(" ") + str("label") + str(" "))
f.write(str(" ").join(str(node_label) for node_label in nodes_label))
Expand Down
2 changes: 1 addition & 1 deletion ml4co_kit/solver/mis/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def to_txt(self, file_path: str = "example.txt"):
with open(file_path, "w") as f:
for graph in self.graph_data:
edge_index = graph.edge_index.T
nodes_label = graph.nodes_label
nodes_label = graph.nodes_label.astype(np.int32)
f.write(" ".join(str(src) + str(" ") + str(tgt) for src, tgt in edge_index))
f.write(str(" ") + str("label") + str(" "))
f.write(str(" ").join(str(node_label) for node_label in nodes_label))
Expand Down
2 changes: 1 addition & 1 deletion ml4co_kit/solver/mvc/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ def to_txt(self, file_path: str = "example.txt"):
with open(file_path, "w") as f:
for graph in self.graph_data:
edge_index = graph.edge_index.T
nodes_label = graph.nodes_label
nodes_label = graph.nodes_label.astype(np.int32)
f.write(" ".join(str(src) + str(" ") + str(tgt) for src, tgt in edge_index))
f.write(str(" ") + str("label") + str(" "))
f.write(str(" ").join(str(node_label) for node_label in nodes_label))
Expand Down

0 comments on commit f46dd70

Please sign in to comment.