helper_functions

Small convenience helpers for interrogating the networkx graph. These are thin wrappers used by higher-level code and tests.

Key functions

  • getRadii() — return a mapping of edge tuples to radii.

  • getRadius() — get the radius for a particular edge tuple.

  • getNode() — access node attributes.

  • getEdgeData() — return the edge data dictionary.

  • getVesselLength() — compute the length of a vessel by following connected edges recursively.

Examples

radii = getRadii(G)
r = getRadius(G, (3, 4))

API reference

Function arguments

getRadii
Gnetworkx.DiGraph

Graph containing vessel edges annotated with a radius attribute.

dict

Mapping (u, v) -> radius for each edge.

getRadius
Gnetworkx.DiGraph

The graph.

nodestuple, optional

Edge tuple (u, v). If omitted the function raises.

float

Radius of the requested edge.

getVesselLength
Gnetworkx.DiGraph

The graph.

initialVesseltuple

Edge tuple (u, v) from which to accumulate connected lengths.

float

Cumulative length of the vessel (m).

Examples

radii = getRadii(G)
r = getRadius(G, (3, 4))
length = getVesselLength(G, (0, 1))

Cross references

  • These helpers are used extensively by the higher-level solvers in FetoFlow.solve_utils and by geometry utilities in FetoFlow.geometry_utils.

    >>> getVesselLength(G, (0, 1))