# Algomin

Visualizing distributed algorithms in JavaScript.


## 🚀 Installation

Install `algomin` using npm.

### `npm install --save algomin`


## 👨🏻‍💻 Usage

```jsx
import React from "react";
import ReactDOM from "react-dom";
import { Algomin } from "algomin";

class App extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            expression_string: "" +
                "Node1 = shape(x=100, y=100, w=100, h=60, label='Node 1')\n" +
                "Node2 = shape(x=400, y=100, w=100, h=60, label='Node 2')\n" +
                "Node1.sendMessage(target=Node2, message='Passing Message', speed=1000)\n" +
                "wait(duration=1000)\n"
        };
    }
    
    componentDidMount() {
        let algomin = new Algomin("algomin_root");
        algomin.parseExpression(this.state.expression_string);
        algomin.start();
    }

    render() {
        return <div id={"algomin_root"} style={{width: 1000, height: 1000, position: "relative"}} />;
    }
}

ReactDOM.render(<App />, document.getElementById("root"));
```

## 💻 Local Development

Install dev dependencies using `npm install`

Run local dev environment running `npm start` 

## ✔ Tests

To verify your code with tests just run `npm run test`

## ⚖ License

MIT