Skip to content

Commit 0c07861

Browse files
Updated negraph docs
1 parent e0b1aec commit 0c07861

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

docs/node-expanded-digraph.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
If your graph has flow values or weights associated with the nodes, instead of the edges, we provide a simple way to handle them, via the class `NodeExpandedDiGraph`, as described below.
44

5+
See [this example](https://github.com/algbio/flowpaths/blob/main/examples/node_weights_flow_correction.py) on how to correct weights on node-weighted graphs, support subpath constraints, and then apply Minimum Flow Decomposition on them.
6+
57
::: flowpaths.nodeexpandeddigraph
68
options:
79
filters:

examples/node_weights_flow_correction.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ def process_expanded_solution(neGraph: fp.NodeExpandedDiGraph, model: fp.MinFlow
2222
graph.add_node("d", flow=2)
2323
graph.add_node("t", flow=20)
2424

25-
# We edges (notice that we do not add flow values to them)
25+
# We add graph edges (notice that we do not add flow values to them)
2626
graph.add_edges_from([("s", "a"), ("s", "b"), ("a", "b"), ("a", "c"), ("b", "c"), ("c", "d"), ("c", "t"), ("d", "t")])
2727

28-
# We create a node expanded graph, where the weights are taken from the attribute "flow"
28+
# We create a node-expanded graph, where the weights are taken from the attribute "flow"
2929
neGraph = fp.NodeExpandedDiGraph(graph, node_flow_attr="flow")
3030

31-
# We correct the graph
31+
# We correct the node-expanded graph
3232
correction_model = fp.MinErrorFlow(
3333
neGraph,
3434
flow_attr="flow",
@@ -41,8 +41,8 @@ def process_expanded_solution(neGraph: fp.NodeExpandedDiGraph, model: fp.MinFlow
4141
subpath_constraints=[[('a', 'c'), ('c', 't')]]
4242

4343
# We solve the problem on the corrected_neGraph
44-
# NOTE: we are using edges_to_ignore from the original neGraph
45-
# NOTE: we are using subpath_constraints from the original neGraph
44+
# NOTE: we are using `edges_to_ignore` from the uncorrected neGraph
45+
# NOTE: we are using `subpath_constraints` from the uncorrected neGraph
4646
ne_mfd_model_edges = fp.MinFlowDecomp(
4747
corrected_neGraph,
4848
flow_attr="flow",

0 commit comments

Comments
 (0)