topology_profile
Function to generate topological profiles from a merge tree.
assign_center(node_id, g, start, end)
Assigns the center of the basin when constructing the profile. Needed for visualization.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
int
|
Node ID. |
required |
g
|
DiGraph
|
Directed graph representation of a merge tree. |
required |
start
|
int
|
Leftmost point. |
required |
end
|
int
|
Rightmost point. |
required |
Source code in src/landscaper/topology_profile.py
build_basin(node_id, g, mt)
Recursively calculates the points needed for each segmentation in the merge tree.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node_id
|
int
|
Node ID to calculate a basin for. |
required |
g
|
DiGraph
|
Directed graph representation of the merge tree. |
required |
mt
|
MergeTree
|
The merge tree. |
required |
Returns:
Type | Description |
---|---|
int
|
Total width of a given basin. |
Source code in src/landscaper/topology_profile.py
generate_profile(mt)
Generates a topological profile based on a merge tree.
Used along with :obj:landscaper.plots.topoplogy_profile
. Can be visualized
directly with a LossLandscape object using :obj:landscaper.landscape.LossLandscape.show_profile
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mt
|
MergeTree
|
The merge tree to generate a profile for. |
required |
Returns:
Type | Description |
---|---|
list[list[list[float]]]
|
Profile data to visualize. |
Source code in src/landscaper/topology_profile.py
get_parent(g, n)
Gets the parent of a node in the directed graph. Errors if there is more than one parent (no longer a tree).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
g
|
DiGraph
|
Directed graph representation of a merge tree. |
required |
n
|
int
|
Node ID to get parent for. |
required |
Returns:
Type | Description |
---|---|
int | None
|
The node id of the parent. |
Raises:
Type | Description |
---|---|
ValueError
|
Thrown when there is more than one parent for a node. |