Skip to content

Commit

Permalink
Add option to STs to control the behavior of the flows
Browse files Browse the repository at this point in the history
  • Loading branch information
pablormier committed May 15, 2024
1 parent 20d8d06 commit 3ff838b
Show file tree
Hide file tree
Showing 3 changed files with 314 additions and 355 deletions.
5 changes: 3 additions & 2 deletions corneto/methods/steiner.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from corneto.backend import DEFAULT_BACKEND, Backend


def __exact_steiner_tree(
def _exact_steiner_tree(
G: BaseGraph,
terminals,
edge_weights=None,
Expand Down Expand Up @@ -108,6 +108,7 @@ def exact_steiner_tree(
tolerance=1e-3,
strict_acyclic=False,
flow_name=VAR_FLOW,
out_flow_edge_type=EdgeType.UNDIRECTED,
backend: Backend = DEFAULT_BACKEND,
):
prized_nodes, prizes = [], []
Expand Down Expand Up @@ -137,7 +138,7 @@ def exact_steiner_tree(
ids = []
for v in terminals:
if v != root:
idx = Gc.add_edge(v, (), type=EdgeType.UNDIRECTED)
idx = Gc.add_edge(v, (), type=out_flow_edge_type)
ids.append(idx) # terminal -> () (sink node, remove flow)
dummy_edges[v] = idx
ids = np.array(ids)
Expand Down
Loading

0 comments on commit 3ff838b

Please sign in to comment.