# knit_graphs
[![PyPI - Version](https://img.shields.io/pypi/v/knit-graphs.svg)](https://pypi.org/project/knit-graphs)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/knit-graphs.svg)](https://pypi.org/project/knit-graphs)
-----
## Description
The knit-graphs packaged provides a data structure for representing knitted structures formed of loops of yarn (nodes) connected by various edge structures. Loops are connected by: floats (yarn-edges) in a yarn graph structure, stitch edges (loops pulled through loops), and crossed over each other in a wale-braid structure.
Knit graphs provide a powerful tool for representing knitted structures for digital fabrication systems such as knitting machine programming languages and design tools.
Additional details about this knit-graph construction are available in the ACM publication:
["KnitPicking Texture: Programming and Modifying Complex Knitted Textures for Machine and Hand Knitting"](https://doi.org/10.1145/3332165.3347886)
## Table of Contents
- [Description](#description)
- [Installation](#installation)
- [Usage](#usage)
- [Knit Graph Generators](#knit-graph-generators)
- [Visualizing Knit Graphs](#visualizing-knit-graphs)
- [Credits](#credits)
- [License](#license)
## Installation
```console
pip install knit-graphs
```
## Usage
### Knit Graph Generators
The [knit-graph-generators subpackage](https://github.com/mhofmann-Khoury/knit_graph/tree/main/src/knit_graphs/knit_graph_generators) provides a library of basic knit graphs to generate such as casting on loops of a knitted structure, creating Jersey (aka Stockinette) tubes and swatches, and other basic textures.
For example, to generate a swatch of knit-purl ribbing use the following:
```python
from knit_graphs.knit_graph_generators.basic_knit_graph_generators import kp_rib_swatch
width = 10
height = 10
kp_rib_swatch = kp_rib_swatch(width, height)
```
Additional examples of knitgraph generator usage can be found in the [Knit_Graph test module](https://github.com/mhofmann-Khoury/knit_graph/blob/main/tests/test_Knit_Graph.py).
Knitgraphs can be created without generators. We encourage users to review the generators as simple examples on creating a knit graph programmatically.
### Visualizing Knit Graphs
We provide simple support for visualizing knit graphs. This is primarily used to debugging simple knit graph programs.
For example, we can visualize a swatch of seed stitch (checkered knit and purl stitches) with the following code.
```python
from knit_graphs.knit_graph_generators.basic_knit_graph_generators import seed_swatch
from knit_graphs.knit_graph_visualizer.Stitch_Visualizer import visualize_stitches
width = 4
height = 4
swatch = seed_swatch(width, height)
visualize_stitches(swatch)
```
The visualizer shows knit stitches (loops pulled from the back of the fabric to the front) as blue edges and purl stitches (loops pulled from the front to back) (aka back-knits) as red edges. Loop nodes are circles labeled with their time-ordered index and colored to match their yarn (defaults to dark green). The yarn edges (aka floats) connecting them are made of thin edges the same color as the loop nodes.
Additional examples of using the visualizer are available in the [Stitch Visualizer Tests Module](https://github.com/mhofmann-Khoury/knit_graph/blob/main/tests/test_Stitch_Visualizer.py)
## Credits
The design of this data scructure was completed by the authors of
["KnitPicking Texture: Programming and Modifying Complex Knitted Textures for Machine and Hand Knitting"](https://doi.org/10.1145/3332165.3347886).
The inclusion of the Artin-Braide wale crossing construction was inspired by ["An Artin Braid Group Representation of Knitting Machine State with Applications to Validation and Optimization of Fabrication Plans"](https://doi.org/10.1109/ICRA48506.2021.9562113) by Jenny Lin and James McCann.
## License
`knit-graphs` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
Raw data
{
"_id": null,
"home_page": null,
"name": "knit-graphs",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.11",
"maintainer_email": null,
"keywords": "ACT Lab, Northeastern, fabrication, knit, machine knit, textile",
"author": null,
"author_email": "Megan Hofmann <m.hofmann@northeastern.edu>",
"download_url": "https://files.pythonhosted.org/packages/99/24/38659811c1d2d42787fec89a23b6e58602efb360184246110c821a897ed7/knit_graphs-0.0.5.tar.gz",
"platform": null,
"description": "# knit_graphs\n\n[![PyPI - Version](https://img.shields.io/pypi/v/knit-graphs.svg)](https://pypi.org/project/knit-graphs)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/knit-graphs.svg)](https://pypi.org/project/knit-graphs)\n\n-----\n## Description\nThe knit-graphs packaged provides a data structure for representing knitted structures formed of loops of yarn (nodes) connected by various edge structures. Loops are connected by: floats (yarn-edges) in a yarn graph structure, stitch edges (loops pulled through loops), and crossed over each other in a wale-braid structure. \n\nKnit graphs provide a powerful tool for representing knitted structures for digital fabrication systems such as knitting machine programming languages and design tools. \n\nAdditional details about this knit-graph construction are available in the ACM publication:\n[\"KnitPicking Texture: Programming and Modifying Complex Knitted Textures for Machine and Hand Knitting\"](https://doi.org/10.1145/3332165.3347886)\n\n## Table of Contents\n- [Description](#description)\n- [Installation](#installation)\n- [Usage](#usage)\n - [Knit Graph Generators](#knit-graph-generators)\n - [Visualizing Knit Graphs](#visualizing-knit-graphs)\n- [Credits](#credits)\n- [License](#license)\n\n\n\n## Installation\n\n```console\npip install knit-graphs\n```\n\n## Usage\n\n### Knit Graph Generators\nThe [knit-graph-generators subpackage](https://github.com/mhofmann-Khoury/knit_graph/tree/main/src/knit_graphs/knit_graph_generators) provides a library of basic knit graphs to generate such as casting on loops of a knitted structure, creating Jersey (aka Stockinette) tubes and swatches, and other basic textures. \nFor example, to generate a swatch of knit-purl ribbing use the following:\n```python\nfrom knit_graphs.knit_graph_generators.basic_knit_graph_generators import kp_rib_swatch\nwidth = 10\nheight = 10\nkp_rib_swatch = kp_rib_swatch(width, height)\n```\nAdditional examples of knitgraph generator usage can be found in the [Knit_Graph test module](https://github.com/mhofmann-Khoury/knit_graph/blob/main/tests/test_Knit_Graph.py).\n\nKnitgraphs can be created without generators. We encourage users to review the generators as simple examples on creating a knit graph programmatically. \n\n### Visualizing Knit Graphs\nWe provide simple support for visualizing knit graphs. This is primarily used to debugging simple knit graph programs. \n\nFor example, we can visualize a swatch of seed stitch (checkered knit and purl stitches) with the following code.\n\n```python\nfrom knit_graphs.knit_graph_generators.basic_knit_graph_generators import seed_swatch\nfrom knit_graphs.knit_graph_visualizer.Stitch_Visualizer import visualize_stitches\n\nwidth = 4\nheight = 4\nswatch = seed_swatch(width, height)\nvisualize_stitches(swatch)\n```\nThe visualizer shows knit stitches (loops pulled from the back of the fabric to the front) as blue edges and purl stitches (loops pulled from the front to back) (aka back-knits) as red edges. Loop nodes are circles labeled with their time-ordered index and colored to match their yarn (defaults to dark green). The yarn edges (aka floats) connecting them are made of thin edges the same color as the loop nodes. \n\nAdditional examples of using the visualizer are available in the [Stitch Visualizer Tests Module](https://github.com/mhofmann-Khoury/knit_graph/blob/main/tests/test_Stitch_Visualizer.py)\n\n## Credits\nThe design of this data scructure was completed by the authors of \n[\"KnitPicking Texture: Programming and Modifying Complex Knitted Textures for Machine and Hand Knitting\"](https://doi.org/10.1145/3332165.3347886).\n\nThe inclusion of the Artin-Braide wale crossing construction was inspired by [\"An Artin Braid Group Representation of Knitting Machine State with Applications to Validation and Optimization of Fabrication Plans\"](https://doi.org/10.1109/ICRA48506.2021.9562113) by Jenny Lin and James McCann.\n\n## License\n\n`knit-graphs` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.",
"bugtrack_url": null,
"license": null,
"summary": "A graph representation of knitted structures where each loop is a node and edges represent yarn and stitch relationships.",
"version": "0.0.5",
"project_urls": {
"Documentation": "https://github.com/mhofmann-Khoury/knit_graph#readme",
"Issues": "https://github.com/mhofmann-Khoury/knit_graph/issues",
"Source": "https://github.com/mhofmann-Khoury/knit_graph"
},
"split_keywords": [
"act lab",
" northeastern",
" fabrication",
" knit",
" machine knit",
" textile"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "835336139f51f1eb884b2863df1e1e620357383f26f924961684d7bd902de6db",
"md5": "c2978fb840a523927efd5af466b2b20d",
"sha256": "36e56d406964383295db593796095cafd0413d0f026a3c2394b630748d5fab13"
},
"downloads": -1,
"filename": "knit_graphs-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c2978fb840a523927efd5af466b2b20d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.11",
"size": 23364,
"upload_time": "2024-11-13T17:43:27",
"upload_time_iso_8601": "2024-11-13T17:43:27.836267Z",
"url": "https://files.pythonhosted.org/packages/83/53/36139f51f1eb884b2863df1e1e620357383f26f924961684d7bd902de6db/knit_graphs-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "992438659811c1d2d42787fec89a23b6e58602efb360184246110c821a897ed7",
"md5": "8a0a64664fee368311023d92bf054465",
"sha256": "27e49049a6d5ce519784c85cf8d88403a211dd5f51d609a6d8f676fc15819b2c"
},
"downloads": -1,
"filename": "knit_graphs-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "8a0a64664fee368311023d92bf054465",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.11",
"size": 5628,
"upload_time": "2024-11-13T17:43:29",
"upload_time_iso_8601": "2024-11-13T17:43:29.152143Z",
"url": "https://files.pythonhosted.org/packages/99/24/38659811c1d2d42787fec89a23b6e58602efb360184246110c821a897ed7/knit_graphs-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-13 17:43:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "mhofmann-Khoury",
"github_project": "knit_graph#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "knit-graphs"
}