mascaf.graph3d

class mascaf.graph3d.Graph3D(*args, backend=None, **kwargs)[source]

Bases: Graph

Undirected graph whose vertices are embedded in 3D.

position_attr = 'xyz'
get_node_position(node)[source]

Return the 3D position of a node.

Return type:

ndarray

Parameters:

node (int)

set_node_position(node, pos)[source]

Set the 3D position of a node.

Return type:

None

Parameters:
get_all_positions()[source]

Return positions of all nodes ordered by sorted node ID.

Return type:

ndarray

set_all_positions(positions)[source]

Set positions of all nodes from an (N, 3) array.

Return type:

None

Parameters:

positions (ndarray)

get_terminal_nodes()[source]

Return nodes of degree 1.

Return type:

Set[int]

get_branch_nodes()[source]

Return nodes of degree at least 3.

Return type:

Set[int]

get_continuation_nodes()[source]

Return nodes of degree 2.

Return type:

Set[int]

is_terminal_node(node)[source]

Return whether a node is terminal.

Return type:

bool

Parameters:

node (int)

is_branch_node(node)[source]

Return whether a node is a branch node.

Return type:

bool

Parameters:

node (int)

is_continuation_node(node)[source]

Return whether a node is a continuation node.

Return type:

bool

Parameters:

node (int)

bounds()[source]

Return axis-aligned bounds of the vertex set.

Return type:

Optional[dict]

midpoint()[source]

Return the mean position of the graph’s vertex set.

Return type:

Optional[ndarray]

get_total_length()[source]

Return the sum of edge lengths.

Missing edge lengths are computed from node geometry.

Return type:

float