algomin

1.0.1 • Public • Published

Algomin

Visualizing distributed algorithms in JavaScript.

🚀 Installation

Install algomin using npm.

npm install --save algomin

👨🏻‍💻 Usage

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

Package Sidebar

Install

npm i algomin

Weekly Downloads

5

Version

1.0.1

License

MIT

Unpacked Size

42 kB

Total Files

16

Last publish

Collaborators

  • tarik_guen