feat: solution for 'Повторный экзамен: Граф с рефлексией и доработкой'

This commit is contained in:
2026-07-01 15:53:59 +03:00
parent 6be5a5c753
commit 9dcbcc6619
4 changed files with 29 additions and 116 deletions
+8 -35
View File
@@ -1,46 +1,19 @@
# Graph with Reflection and Rewriting Nodes
# Project Title
This project implements a simple directed graph data structure in JavaScript that supports three types of nodes:
This project demonstrates a simple usage of the `langgraph` library.
- **Generic Node** the base node type.
- **Reflection Node** represents a node that reflects on itself.
- **Rewriting Node** represents a node that rewrites or transforms data.
## Installation
## Setup
```bash
npm install
pip install -r requirements.txt
```
## Running Tests
## Run
```bash
npm test
python main.py
```
## Usage
## Notes
```js
import { Graph, Node, ReflectionNode, RewritingNode } from './src/index.js';
const graph = new Graph();
const n1 = new Node('n1');
const r1 = new ReflectionNode('r1');
const w1 = new RewritingNode('w1');
graph.addNode(n1);
graph.addNode(r1);
graph.addNode(w1);
graph.addEdge('n1', 'r1');
graph.addEdge('r1', 'w1');
graph.traverse('n1', (node) => {
console.log(node.id, node.type);
});
```
## License
MIT
The `langgraph` package is required for this project. It is specified in `requirements.txt` with a minimum version of 0.0.1.