Prerequisites
Before you begin, ensure you have the following installed:- Node.js (v16 or higher recommended)
- npm, yarn, or pnpm package manager
- Git for cloning the repository
Installation Steps
Install Dependencies
Install all required packages using your preferred package manager:This will install all dependencies including:
- React 18.2.0 and React DOM
- Ant Design 5.18.0 for UI components
- Chart.js and react-chartjs-2 for visualizations
- Vite for build tooling
- TypeScript for type safety
Start the Development Server
Launch the Vite development server:The application will be available at
http://localhost:5173 in your browser.Verify Installation
Open your browser and navigate to
http://localhost:5173. You should see the C-Means Algorithm Calculator interface with:- Input fields for adding points and centroids
- Empty point and centroid tables
- A blank scatter plot chart
- Iterate and Reset buttons
Additional Commands
Once you have the project set up, you can use these additional npm scripts:Build for Production
Create an optimized production build:- Runs the TypeScript compiler (
tsc) to check for type errors - Uses Vite to bundle and optimize the application
- Outputs the built files to the
dist/directory
Preview Production Build
Preview the production build locally:Lint the Codebase
Run ESLint to check for code quality issues:- Check
.tsand.tsxfiles - Report unused disable directives
- Fail on any warnings (max-warnings 0)
Project Structure
After installation, your project directory will look like this:The
src/utils/ directory contains the core clustering algorithm logic, while src/components/ contains the React components for the user interface.Troubleshooting
Port Already in Use
If port 5173 is already in use, Vite will automatically try the next available port (5174, 5175, etc.). Check the terminal output for the actual URL.Dependency Installation Errors
If you encounter errors duringnpm install, try: