Skip to content

Commit

Permalink
change depcreated iGraph.clusters() -> iGraph.connected_components()
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Jul 29, 2024
1 parent f1ee161 commit a703164
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion skeletor/skeletonize/teasar.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions skeletor/skeletonize/wave.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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])
Expand Down

0 comments on commit a703164

Please sign in to comment.