Build and visualize orbit graphs for discrete iterations under guarded rules.
Project description
VisIter
See what a discrete iteration actually does — as a graph.
The simplest case
Integers 1–9. Case: divisible by 3 → divide by 3. Default (everything else) → add 2. Where does each value end up?
#!/usr/bin/env viter
(viter(range(1, 10))
.case(lambda x: x % 3 == 0, lambda x: x // 3)
.default(lambda x: x + 2)
.render())
Save as descent.vit, run with viter descent.vit > out.svg. The
#!/usr/bin/env viter shebang also lets you chmod +x descent.vit
and execute the file directly.
.render() is the shortcut terminal — it builds the graph, converts
to Graphviz, and writes SVG to stdout in one call.
Install
pip install visiter
Graphviz must be available on PATH (brew install graphviz /
apt install graphviz).
Going further
.render() is convenient for the common case. For anything more —
cropping, custom colors, side-effects, filters — materialize the
Graph explicitly via .build() and keep chaining:
#!/usr/bin/env viter
(viter(range(1, 10))
.case(lambda x: x % 3 == 0, lambda x: x // 3)
.default(lambda x: x + 2)
.build()
.to_dot(anchor=1, radius=8, direction="backward")
.render())
Save intermediate results with .tap():
(viter(...).case(...).default(...).build()
.tap(write(file="graph.json"))
.to_dot()
.render(file="out.svg"))
Use NetworkX for graph analysis via .filter():
import networkx as nx
(viter(...).case(...).default(...).build()
.filter(NxFilter(nx.condensation))
.to_dot()
.render())
If-elif-else semantics (first matching case wins) via match=Match.FIRST:
(viter(range(1, 17), match=Match.FIRST)
.case(lambda x: x % 2 == 0, lambda x: x // 2)
.case(lambda x: x % 3 == 0, lambda x: x // 3)
.default(lambda x: x * 5 + 7)
.render())
Use the Python API directly (outside .vit files):
from visiter import viter
graph = (viter(range(1, 10))
.case(lambda x: x % 3 == 0, lambda x: x // 3)
.default(lambda x: x + 2)
.build())
graph.to_dot().render(file="descent.svg")
Why VisIter?
Free, scriptable, Graphviz-native orbit-graph rendering for discrete iterations under guarded rules — with cutoff boundaries (bounds, depth limits, render crops) as a first-class visual primitive, not silent truncation.
Full honest comparison against NetworkX, NestGraph (Mathematica), Maude, LoLA, and continuous-dynamics tooling: docs/comparison.md.
Documentation
- docs/tutorial.md — gentle introduction: what problem the tool solves, smallest example, what each piece does, what the dashed arrows mean. Start here.
- docs/manual.md — reference: every parameter, every data field, the rendering model in full, design decisions.
- docs/comparison.md — how VisIter relates to other tools in the ecosystem, and when to pick something else.
- demos/ — runnable
.vitexamples organized by topic (basics/,rendering/,integration/,applications/).
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file visiter-0.12.0.tar.gz.
File metadata
- Download URL: visiter-0.12.0.tar.gz
- Upload date:
- Size: 422.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cca47e7a44ea59c609e202a9229851c35380f97c6fb17ded37dd6a1d687155b3
|
|
| MD5 |
6e213c761ff6c2871b0796cece708b77
|
|
| BLAKE2b-256 |
e80e99394436a390b254dcfcc9e478297431dfbd0129c0b90a6b67cc654b957b
|
File details
Details for the file visiter-0.12.0-py3-none-any.whl.
File metadata
- Download URL: visiter-0.12.0-py3-none-any.whl
- Upload date:
- Size: 31.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04929f8d4669e3338ad5bab1bf4a2f8128b42f725a9f6940031cac6a82948e2c
|
|
| MD5 |
9bf92384d9f746359dfd808714ed7932
|
|
| BLAKE2b-256 |
6a6e2850013594c12a49869760c21a7eca5812e37a4fedf85425d90c17ad70d7
|