Skip to content

Commit

Permalink
black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
ohjuny committed Oct 18, 2024
1 parent 3e07341 commit 556940a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lowtime/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,9 @@ def find_min_cut(self, dag: nx.DiGraph) -> tuple[set[int], set[int]]:
)

# Helper function for Rust interop
def format_rust_inputs(dag: nx.DiGraph) -> tuple[nx.NodeView, list[tuple[tuple[int, int], np.float64]]]:
def format_rust_inputs(
dag: nx.DiGraph,
) -> tuple[nx.NodeView, list[tuple[tuple[int, int], np.float64]]]:
nodes = unbound_dag.nodes
edges = [
((u, v), cap)
Expand All @@ -447,7 +449,9 @@ def format_rust_inputs(dag: nx.DiGraph) -> tuple[nx.NodeView, list[tuple[tuple[i

# Helper function for Rust interop
# Note: this returns flows as float, not np.float64
def reformat_rust_flow_to_dict(flow_vec: list[tuple[tuple[int, int], float]], dag: nx.DiGraph) -> dict[int, dict[int, float]]:
def reformat_rust_flow_to_dict(
flow_vec: list[tuple[tuple[int, int], float]], dag: nx.DiGraph
) -> dict[int, dict[int, float]]:
# ohjun: technicality. Rust's pathfinding::edmonds_karp doesn't
# return edges with 0 flow, but nx.max_flow does. So we fill in
# the 0s and empty nodes.
Expand All @@ -459,7 +463,7 @@ def reformat_rust_flow_to_dict(flow_vec: list[tuple[tuple[int, int], float]], da

for (u, v), cap in flow_vec:
flow_dict[u][v] = cap

return flow_dict

# We're done with constructing the DAG with only flow upper bounds.
Expand Down

0 comments on commit 556940a

Please sign in to comment.