Skip to content

utils

NeighborRings

Find neighbor ring around utils nodes.

Attributes:

Name Type Description
neighbors_matrix ndarray[N, N]

Array with values indicating edge (or any other) distances between nodes.

projection_plane_normals ndarray[N, 3]

Array with normals of planes where rings are projected onto before sorting them.

angles = [] instance-attribute

coords = coords instance-attribute

edges = edges instance-attribute

n_nodes = 0 instance-attribute

neighbors_matrix = None instance-attribute

projection_plane_normals = None instance-attribute

radius = None instance-attribute

__init__(coords, edges)

best_fitting_plane_normals(rings)

Calculates the best fitting plane normals by performing Singular Value Decomposition (SVD) on the covariance matrix of the ring points. This decomposition calculates 3 eigenvectors (in 3D) which are used to retrieve the direction of lowest covariance. This is done by taking the eigenvector corresponding to the lowest Singular Value. The eigenvector is flipped if it is opposite to the vector connecting the utils center and ring center.

Parameters:

Name Type Description Default
rings ndarray[N, M]

Neighbor rings. M is max number of nodes in the rings. If node has less than M ring nodes, the row tail is filled by the last node found on the ring.

required

Returns:

Type Description
ndarray

np.ndarray[N, 3]: Array containing the normals of the best fitting projection planes where all ring nodes are projected onto.

compute()

Calculates sorted neighbor rings given a graph and ring radius distance.

Returns:

Type Description
ndarray

np.ndarray[N, M]: Sorted rings by increasing angle.

get_neighbor_angles(rings)

Calculates angles of nodes on rings relative to ring centers.

Parameters:

Name Type Description Default
rings ndarray[N, M]

neighbor rings. M is max number of nodes in the rings. If node has less than M ring nodes, the row tail is filled by the last node found on the ring.

required

Returns:

Type Description
ndarray

np.ndarray[N, M]: Angles of nodes on rings relative to ring centers. M is max number of nodes in the rings. If node has less than M ring nodes, the row tail is filled by the angle of the last node found on the ring.

get_ring_nodes()

Calculates rings around every utils node which are defined as points with equal shortest edge distance from the utils node.

Returns:

Type Description
ndarray

np.ndarray[N, M]: neighbor rings. M is max number of nodes in the rings. If node has less than M ring nodes, the row tail is filled by the last node found on the ring.

set_neighbors_matrix()

Calculates nodal distance matrix by converting input weighted utils to unweighted utils using networkit.

set_radius(radius)

Radius of the rings expressed in number of edges.

sort_rings(rings, angles)

Sort rings by increasing angle.

Parameters:

Name Type Description Default
rings ndarray[N, M]

Neighbor rings. M is max number of nodes in the rings. If node has less than M ring nodes, the row tail is filled by the last node found on the ring.

required

Returns:

Type Description
ndarray

np.ndarray[N, M]: Sorted rings by increasing angle.