greedy_neighborhood_old#

tangles.util.graph.greedy_neighborhood_old(adj: csr_array, start_neighborhood: int | list | ndarray, size: int, take: int = 5, forbidden_vertices: list | set = None, minimize_weight=False)#

Search a neighborhood in the graph with adjacency matrix A.

Parameters#

adjsparse.csr_array

The adjacency matrix of a graph.

start_neighborhoodint, list or np.ndarray

Indices of vertices to start with.

sizeint

Size of the neighborhood.

takeint

Number of neighbors added in each step. Only the best ones are taken.

forbidden_verticeslist or set, optional

Set of vertices that should not be added to the neighborhood.

minimize_weightbool

If True, the greedy procedure selects edges with the smallest weight.

Returns#

np.ndarray

The indices of the found neighborhood.