diff --git a/skeletor/skeletonize/teasar.py b/skeletor/skeletonize/teasar.py index 4842c3c..0d4f647 100644 --- a/skeletor/skeletonize/teasar.py +++ b/skeletor/skeletonize/teasar.py @@ -98,7 +98,7 @@ def by_teasar(mesh, inv_dist, min_length=None, root=None, progress=True): with tqdm(desc='Invalidating', total=len(G.vs), disable=not progress, leave=False) as pbar: - for cc in sorted(G.clusters(), key=len, reverse=True): + for cc in sorted(G.connected_components(), key=len, reverse=True): # Make a subgraph for this connected component SG = G.subgraph(cc) cc = np.array(cc) diff --git a/skeletor/skeletonize/wave.py b/skeletor/skeletonize/wave.py index 7c1bbb7..5c4df9c 100644 --- a/skeletor/skeletonize/wave.py +++ b/skeletor/skeletonize/wave.py @@ -142,6 +142,7 @@ def by_wavefront(mesh, else: weights = np.linalg.norm(node_centers[el[:, 0]] - node_centers[el[:, 1]], axis=1) + tree = G.spanning_tree(weights=1 / weights) # Create a directed acyclic and hierarchical graph @@ -195,7 +196,7 @@ def _cast_waves(mesh, waves=1, origins=None, step_size=1, # Go over each connected component with tqdm(desc='Skeletonizing', total=len(G.vs), disable=not progress) as pbar: - for cc in G.clusters(): + for cc in G.connected_components(): # Make a subgraph for this connected component SG = G.subgraph(cc) cc = np.array(cc) @@ -241,7 +242,7 @@ def _cast_waves(mesh, waves=1, origins=None, step_size=1, this_dist = this_wave == i ix = np.where(this_dist)[0] SG2 = SG.subgraph(ix) - for cc2 in SG2.clusters(): + for cc2 in SG2.connected_components(): this_verts = cc[ix[cc2]] this_center = mesh.vertices[this_verts].mean(axis=0) this_radius = cdist(this_center.reshape(1, -1), mesh.vertices[this_verts])