Catalog PyPI
PACKAGE EXPLORERView in registry

aialgos

PyPI

Beginner-friendly AI search algorithms: BFS, DFS, A*, Minimax, CSP, ANN and more

a-staraialgorithmsartificial-intelligencebeginnersbfscspdfseducationmachine-learningminimaxneural-networksearch
Versions collected1
Direct dependencies0From release 0.1.0
Last observed21 Oct, 09:55 UTC

README

Version 0.1.0 documentation

aialgos 🤖

A beginner-friendly Python library covering the core AI algorithms taught in university courses.

Zero dependencies — pure Python, works everywhere.

pip install aialgos

What's inside?

ModuleAlgorithms
uninformedBFS, DFS, DLS, UCS, Bidirectional BFS
informedGreedy Best-First, A*
adversarialMinimax, Alpha-Beta Pruning
beyond_classicalHill Climbing, Steepest-Ascent HC, Simulated Annealing, Local Beam Search
cspBacktracking, Forward Checking, MRV, LCV, Degree Heuristic
annFeedforward Neural Network (from scratch)

Quick Start

Uninformed Search (BFS)

from aialgos import bfs

graph = {
    'A': ['B', 'C'],
    'B': ['D', 'E'],
    'C': ['F'],
    'D': [], 'E': [], 'F': []
}

path = bfs(graph, start='A', goal='E')
print(path)  # ['A', 'B', 'E']

Informed Search (A*)

from aialgos import a_star

graph = {
    'A': [('B', 1), ('C', 4)],
    'B': [('D', 5)],
    'C': [('D', 1)],
    'D': []
}
heuristic = {'A': 4, 'B': 3, 'C': 1, 'D': 0}

path, cost = a_star(graph, 'A', 'D', heuristic)
print(path, cost)  # ['A', 'C', 'D'] 5

Adversarial Search (Minimax)

from aialgos import minimax

# Game tree as nested lists (leaf values: positive=MAX wins)
tree = {'A': ['B', 'C'], 'B': ['D', 'E'], 'C': ['F', 'G'],
        'D': 3, 'E': 5, 'F': 2, 'G': 9}

def get_children(node):
    v = tree[node]
    return v if isinstance(v, list) else []

def evaluate(node):
    v = tree[node]
    return v if isinstance(v, int) else 0

score = minimax('A', depth=0, is_maximizing=True,
                get_children=get_children, evaluate=evaluate, max_depth=2)
print(score)  # 5

Neural Network (ANN)

from aialgos import NeuralNetwork

# Solve XOR problem
nn = NeuralNetwork([2, 4, 1], learning_rate=0.1)

X = [[0,0], [0,1], [1,0], [1,1]]
y = [[0],   [1],   [1],   [0]]

nn.train(X, y, epochs=2000, print_every=500)

print(nn.predict([0, 1]))  # ≈ [0.95]
print(nn.predict([0, 0]))  # ≈ [0.05]

CSP (Map Coloring)

from aialgos import forward_checking

variables = ['WA', 'NT', 'SA', 'Q', 'NSW', 'V']
domains   = {v: ['Red', 'Green', 'Blue'] for v in variables}

def diff(a, b): return a != b

constraints_map = {
    'WA':  [('NT', diff), ('SA', diff)],
    'NT':  [('WA', diff), ('SA', diff), ('Q', diff)],
    'SA':  [('WA', diff), ('NT', diff), ('Q', diff), ('NSW', diff), ('V', diff)],
    'Q':   [('NT', diff), ('SA', diff), ('NSW', diff)],
    'NSW': [('Q',  diff), ('SA', diff), ('V', diff)],
    'V':   [('SA', diff), ('NSW', diff)],
}

result = forward_checking(variables, domains, constraints_map)
print(result)  # {'WA': 'Red', 'NT': 'Green', 'SA': 'Blue', ...}

Installation

pip install aialgos

Or install from source:

git clone https://github.com/mQasim04/aialgos
cd aialgos
pip install -e .

Similar Libraries

LibraryFocus
aima3Textbook algorithms (Russell & Norvig) - less beginner-friendly
networkxGraph algorithms only
python-constraintCSP only
scikit-learnML — no search algorithms
aialgosAll-in-one, beginner-focused, zero dependencies

License

MIT — free to use in education and projects.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.022 May 20260

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
mqasim04/aialgos

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:55 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:f0f0c12c8631c98bbea7bc597a130b1437ee65856d77d5654386fd90cf52414a