Metadata-Version: 2.4
Name: grover-visualizer
Version: 0.1.3
Summary: Visualize Grover's Algorithm with quantum state animations
Home-page: https://github.com/SilentSword123456/Groovers_Algorithm-Quantum
Author: Silent Sword
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
Requires-Dist: qiskit>=1.0.0
Requires-Dist: qiskit-aer>=0.13.0
Requires-Dist: qiskit-ibm-runtime>=0.17.0
Requires-Dist: matplotlib>=3.7.0
Requires-Dist: numpy>=1.24.0
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Quantum Grover's Algorithm with Visualization

This project implements Grover's Algorithm using Qiskit and provides an animation of the probability amplitudes as the algorithm progresses through its iterations.

## Features
- **Grover's Search Algorithm**: Implementation of the quantum search algorithm.
- **Dynamic Oracle**: Configurable target states for the search.
- **State Visualization**: Real-time animation of probability distributions after each iteration.
- **Hybrid Backend Support**: Automatically falls back to local `AerSimulator` if IBM Quantum connection is unavailable.
- **Optimal Iteration Calculation**: Automatically determines the number of iterations needed based on the number of qubits and target states.

## Prerequisites
To run this project, you need Python 3.8+ installed along with the following libraries:
- `qiskit>=1.0.0`
- `qiskit-aer>=0.13.0`
- `qiskit-ibm-runtime>=0.17.0`
- `matplotlib>=3.7.0`
- `numpy>=1.24.0`

## Installation
You can install the package directly from PyPI:
```bash
pip install grover-visualizer
```

You can install the dependencies using `requirements.txt`:
```bash
pip install -r requirements.txt
```

Or install the required dependencies manually:
```bash
pip install qiskit qiskit-aer qiskit-ibm-runtime matplotlib numpy
```

## Usage
After installation, you can run the visualization using:
```bash
python -m grover_visualizer.grover
```

### Configuration
In `grover_visualizer/grover.py`, you can modify the `targets` list to change the state(s) you are searching for:
```python
targets = ['0101']  # Change this to any bitstring of your choice
```

## Project Structure
- `grover_visualizer/grover.py`: The core script that constructs the quantum circuit, runs the simulation, and manages the algorithm's iterations.
- `grover_visualizer/animation.py`: Contains the logic for the Matplotlib-based animation of quantum states.

## How it Works
1. **Initialization**: The circuit starts by applying Hadamard gates to all qubits, creating a uniform superposition of all possible states.
2. **Oracle**: A phase-flip oracle marks the target state(s) by reversing their signs.
3. **Diffusion (Inversion about the Mean)**: This operator amplifies the probability amplitude of the marked state while decreasing the amplitudes of other states.
4. **Repetition**: The Oracle and Diffusion steps are repeated for the optimal number of times ($\approx \frac{\pi}{4}\sqrt{2^n/M}$).
5. **Animation**: The `grover_visualizer/animation.py` module tracks the statevector after each iteration to visualize how the probability of the target state grows.
6. **Measurement**: Finally, the qubits are measured, and the results are displayed as a histogram of counts.
