display_and_export
display_and_export_graph_of_fiedler_vector Link
display_and_export_graph_of_fiedler_vector(pcd_g, filename='fiedler_vector.png', sorted_by_fiedler_vector=True)
Displays and exports a plot of the Fiedler vector.
Parameters:
-
pcd_g
(PointCloudGraph
) –The graph containing Fiedler vector data.
-
filename
(str or Path
, default:'fiedler_vector.png'
) –The file name for saving the output plot.
-
sorted_by_fiedler_vector
(bool
, default:True
) –Whether to sort the data by the Fiedler vector values.
Source code in spectral_clustering/display_and_export.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
|
display_and_export_graph_of_gradient_of_fiedler_vector Link
display_and_export_graph_of_gradient_of_fiedler_vector(pcd_g, filename='Gradient_of_fiedler_vector.png', sorted_by_fiedler_vector=True, sorted_by_gradient=False)
Displays and exports a plot of the gradient of the Fiedler vector.
Parameters:
-
pcd_g
(PointCloudGraph
) –The graph containing Fiedler vector gradient data.
-
filename
(str or Path
, default:'Gradient_of_fiedler_vector.png'
) –The file name for saving the output plot.
-
sorted_by_fiedler_vector
(bool
, default:True
) –Whether to sort the data by the Fiedler vector values.
-
sorted_by_gradient
(bool
, default:False
) –Whether to sort the data by the gradient values.
Source code in spectral_clustering/display_and_export.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
|
display_and_export_quotient_graph_matplotlib Link
display_and_export_quotient_graph_matplotlib(qg, node_sizes=20, name='quotient_graph_matplotlib', data_on_nodes='intra_class_node_number', data=True, attributekmeans4clusters=False, round=False, directory='.')
Generates a matplotlib visualization for the given quotient graph and exports it to a file.
Visualizes the input graph using NetworkX's drawing functions with matplotlib. The appearance of the graph, including node colors, labels, and sizes, can be customized based on the given parameters. The plot is saved to the specified file.
Parameters:
-
qg
(QuotientGraph
) –The input graph to be visualized and exported.
-
node_sizes
(int
, default:20
) –Size of the nodes in the plot, by default
20
. -
name
(str
, default:'quotient_graph_matplotlib'
) –The name of the file where the graph visualization plot is saved.
-
data_on_nodes
(str
, default:'intra_class_node_number'
) –The name of the attribute on the nodes to be displayed as labels, by default 'intra_class_node_number'.
-
data
(bool
, default:True
) –Determines whether to use node-specific data attributes in visualization, by default
True
. -
attributekmeans4clusters
(bool
, default:False
) –If
True
, the visualization integrates clustering-specific attributes and uses k-means related coloring, by defaultFalse
. -
round
(bool
, default:False
) –If
True
, rounds the node attribute values for display, by defaultFalse
. -
directory
(str or Path
, default:'.'
) –A path to the output directory. Defaults to the current working directory.
Source code in spectral_clustering/display_and_export.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 |
|
display_gradient_vector_field Link
display_gradient_vector_field(pcd_g, normalized=True, scale=1.0, filename='gradient_vectorfield_3d.png')
Display the gradient vector field of a 3D topology.
This function visualizes the gradient vector field of a provided topology using arrows as glyphs in a 3D representation. It supports configurable vector normalization, glyph scaling, and output filename for saving the visualization as an image.
Parameters:
-
pcd_g
(PointCloudGraph
) –The topology graph object, containing nodes with associated coordinates and gradient data.
-
normalized
(bool
, default:True
) –Specifies whether the vectors should be normalized. If
True
, the scaled direction gradient on the Fiedler vector is used. Otherwise, the original gradient is scaled with the direction gradient on the Fiedler vector. -
scale
(float
, default:1.0
) –Factor by which the arrow glyphs representing the gradient vectors should be scaled. Defaults to
1.0
. -
filename
(str or Path
, default:'gradient_vectorfield_3d.png'
) –The name of the output image file where the visualization will be saved. Defaults to
'gradient_vectorfield_3d.png'
.
Source code in spectral_clustering/display_and_export.py
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 |
|
draw_quotientgraph_cellcomplex Link
draw_quotientgraph_cellcomplex(pcd, qg, pcd_g, color_attribute='quotient_graph_node', filename='graph_and_quotientgraph_3d.png')
Draws and visualizes a cell complex derived from a quotient graph in 3D visualization.
The method creates a topomesh representation of the input quotient graph, assigns vertex colors based on specified attributes, calculates edge properties (e.g., length), and renders the visualization. It allows customization of glyph type, color maps, and visual output filename.
Parameters:
-
pcd
(PointCloud or ndarray
) –Point cloud data, either as an Open3D PointCloud object or a NumPy array containing point coordinates. If provided as Open3D PointCloud, the points are extracted and used as input.
-
qg
(QuotientGraph
) –Quotient graph describing the cell complex structure. The graph should contain nodes and edges associated with the geometric representation of the input data.
-
pcd_g
(PointCloudGraph
) –Graph specifying additional properties such as positions ('pos') and the visualization attributes for nodes in 3D. This graph is used to represent the original structure.
-
color_attribute
(str
, default:'quotient_graph_node'
) –Name of the property to be used for coloring the vertex glyphs. Defaults to
'quotient_graph_node'
. It can be changed to any node attribute present in the input quotient graph. -
filename
(str or Path
, default:'graph_and_quotientgraph_3d.png'
) –Path and name of the file where the rendered 3D visualization will be saved as a screenshot. Defaults to
'graph_and_quotientgraph_3d.png'
.
Source code in spectral_clustering/display_and_export.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 |
|
draw_quotientgraph_matplotlib_3D Link
draw_quotientgraph_matplotlib_3D(nodes_coords_moy, qg)
Draws a 3D visualization of a quotient graph using Matplotlib.
The function takes in the 3D coordinates of nodes and a quotient graph object, and visualizes the nodes and edges of the graph in three dimensions.
Parameters:
-
nodes_coords_moy
(ndarray
) –A 2D numpy array of shape
(n, 3)
, where n represents the number of graph nodes. Each row corresponds to the 3D coordinates of a node. -
qg
(QuotientGraph
) –A quotient graph to be visualized.
Notes
The function uses a matplotlib 3D scatter plot to render the nodes of the graph
and draws lines connecting the nodes to represent edges. Node coordinates are
specified in the nodes_coords_moy
parameter, while edge connectivity is
derived from the QG
graph structure.
Source code in spectral_clustering/display_and_export.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 |
|
export_anything_on_point_cloud Link
export_anything_on_point_cloud(pcd_g, attribute, filename='pcd_attribute.txt')
Exports a specified attribute to the point cloud.
Parameters:
-
pcd_g
(PointCloudGraph
) –The graph containing nodes coordinates.
-
attribute
(ndarray
) –An array representing the attribute values to export.
-
filename
(str or Path
, default:'pcd_attribute.txt'
) –The name of the output file.
Source code in spectral_clustering/display_and_export.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
export_clustering_labels_on_point_cloud Link
export_clustering_labels_on_point_cloud(pcd_g, filename='pcd_clustered.txt')
Exports clustering labels of a graph to a point cloud.
Parameters:
-
pcd_g
(PointCloudGraph
) –The graph containing nodes coordinates and clustering labels.
-
filename
(str or Path
, default:'pcd_clustered.txt'
) –The file name for the output.
Source code in spectral_clustering/display_and_export.py
37 38 39 40 41 42 43 44 45 46 47 48 49 |
|
export_fiedler_vector_on_pointcloud Link
export_fiedler_vector_on_pointcloud(G, filename='pcd_vp2.txt')
Exports the Fiedler vector to a point cloud.
Parameters:
-
G
(PointCloudGraph
) –The graph containing nodes coordinates and Fiedler vector data.
-
filename
(str or Path
, default:'pcd_vp2.txt'
) –The file name for the output.
Source code in spectral_clustering/display_and_export.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
|
export_gradient_of_fiedler_vector_on_pointcloud Link
export_gradient_of_fiedler_vector_on_pointcloud(pcd_g, filename='pcd_vp2_grad.txt')
Exports the gradient of the Fiedler vector to a point cloud.
Parameters:
-
pcd_g
(PointCloudGraph
) –The graph containing nodes coordinates and fiedler gradient data.
-
filename
(str
, default:'pcd_vp2_grad.txt'
) –The file name for the output.
Source code in spectral_clustering/display_and_export.py
71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
export_quotient_graph_attribute_on_point_cloud Link
export_quotient_graph_attribute_on_point_cloud(qg, attribute, name='', directory='.')
Exports attributes from a quotient graph to a point cloud.
Parameters:
-
qg
(QuotientGraph
) –The quotient graph containing point cloud and attribute data.
-
attribute
(str
) –The attribute from the quotient graph nodes to be exported.
-
name
(str
, default:''
) –A suffix to append to the output file name.
-
directory
(str or Path
, default:'.'
) –A path to the output directory. Defaults to the current working directory.
Source code in spectral_clustering/display_and_export.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
|
export_some_graph_attributes_on_point_cloud Link
export_some_graph_attributes_on_point_cloud(pcd_g, graph_attribute='quotient_graph_node', filename='graph_attribute.txt')
Exports specific graph attributes to a point cloud.
Parameters:
-
pcd_g
(PointCloudGraph
) –The graph containing nodes and the requested attribute.
-
graph_attribute
(str
, default:'quotient_graph_node'
) –The name of the graph attribute to export.
-
filename
(str or Path
, default:'graph_attribute.txt'
) –The file name for the output.
Source code in spectral_clustering/display_and_export.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
|