Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Parallel Fractal Net Evolution Approach (FNEA) Partitioning

A parallelized C++ implementation of the Fractal Net Evolution Approach (FNEA) algorithm for hierarchical graph partitioning, with Python bindings.

Overview

This module implements a parallel version of the FNEA algorithm, which creates hierarchical partitions of graphs by iteratively merging nodes based on mutual best-fitting criteria. The algorithm is particularly useful for:

  • Point cloud segmentation
  • Graph-based clustering
  • Hierarchical data analysis
  • Supervoxel generation

Algorithm Description

FNEA performs hierarchical graph partitioning using the following approach:

  1. Best Merge Selection: For each node, find the neighbor that minimizes heterogeneity increase
  2. Mutual Best-Fitting: Only merge nodes that are mutual best candidates
  3. Node Merging: Update node features, positions, and connectivity
  4. Graph Rebuilding: Compact the graph representation and recompute edge weights
  5. Iteration: Repeat until no more merges are possible

The parallel implementation uses OpenMP to accelerate the computationally intensive loops.

Features

  • Parallel Processing: OpenMP-based parallelization for improved performance
  • Feature Heterogeneity: Supports multi-dimensional feature vectors
  • Shape Heterogeneity: Incorporates spatial compactness constraints
  • Flexible Weighting: Configurable balance between feature and shape heterogeneity
  • Python Integration: Easy-to-use Python wrapper with NumPy integration

Directory Structure

parallel_fnea/
├── include/          # C++ header files
├── src/              # C++ source files
├── python/           # Python bindings
│   ├── cpython/      # C Python interface
│   ├── wrappers/     # Python wrapper functions
│   └── bin/          # Compiled Python extensions
├── README.md         # This file
└── LICENSE           # License information

Compilation

Python Extension

cd python
python setup.py build_ext

The compiled module will be available in the bin/ directory.

Usage

Python Interface

from parallel_fnea import fnea_partition_level

# Prepare your data
coords = np.array(...)      # Node grid coordinates (N x 3)
pos = np.array(...)      # Node positions (N x 3)
x = np.array(...)        # Node features (N x D)
h = np.array(...)        # Node heterogeneity (N x D)
bb = np.array(...)       # Bounding boxes (N x 3)
rgb = np.array(...)      # Node colors (N x 3)
source_csr = np.array(...) # CSR source indices
target = np.array(...)     # CSR target indices
edge_weights = np.array(...) # Edge weights

# Run FNEA partition
super_index, coords_out pos_out, bb_out, rgb_out, x_c, cluster, edges, times = fnea_partition_level(
    coords, pos, x, h, bb, rgb, source_csr, target, edge_weights,
    vert_weights=node_counts,
    scale_factor=10.0,
    compactness=0.2,
    spatial_weight=0.5,
    verbose=True,
    max_num_threads=4
)

Parameters

  • scale_factor: Controls partition coarseness (higher values = coarser partitions)
  • compactness: Spatial compactness weight [0, 1]
  • spatial_weight: Balance between feature and spatial heterogeneity [0, 1]
  • max_num_threads: Maximum number of OpenMP threads to use
  • verbose: Enable progress output

Performance

The parallel implementation provides significant speedup over the pure Python version, especially for large graphs:

  • Small graphs (< 1K nodes): 2-3x speedup
  • Medium graphs (1K-10K nodes): 5-10x speedup
  • Large graphs (> 10K nodes): 10-20x speedup

Performance scales well with the number of available CPU cores.

References

This implementation is based on the Fractal Net Evolution Approach for hierarchical graph partitioning, adapted for modern parallel computing environments.

License

This software is under the GPLv3 license.

About

This project is a parallel 3D implementation of the Fractal Net Evolution Approach for point cloud segmentation

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages