bstone / Visualize-M2

A Macaulay2 (https://github.com/Macaulay2/M2) package to help visualize algebraic objects in the browser using javascript.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Visualize.m2

A Macaulay2 package to help visualize algebraic objects in the browser using javascript. This package is still in development. There are many great features that are not detailed below, but this should get you the idea of what we are doing. The goal (as of now) is to support the following packages: Graphs.m2; SimplicialComplexes.m2; Posets.m2; AlgebraicSplines.m2. If you would like us to support other packages, please let us know.

Usage

Assuming Macaulay2 is installed on your machine, the following directions will help in the downloading and running of Visualize.m2.

First Clone the Repository

The easiest way to download the needed files is to clone the entire repository. You will need to install Git for this.

git clone https://github.com/b-stone/Visualize-M2.git
cd Visualize-M2

You only need the Visualize.m2 file and the folder /Visualize/ but the other stuff is bonus.

Running in M2

First make sure that the file Visualize.m2 is on the load path. To run, execute the following (This is assuming that Visualize.m2 is on the path):

loadPackage "Visualize"
openPort "8080" -- opens the port for the browser to communicate with M2

-- Define your favorite supported object. 
G = graph({{0,1},{0,3},{0,4},{1,3},{2,3}},Singletons => {5}) 

-- Start visualizing! 
H = visualize G

-- At this point you can edit the graph in the browser (add/delete vertices or edges). 
-- Your new graph is exported to M2 when you click `End Session`.
-- You can now perform more operations to it.
K = spanningForest H
J = visualize K

-- Once you are done, click `End Session` once again in the browser.
-- To finish, either close M2 or run `closePort()`. Either one will
-- close the port you opened earlier.
closePort()

Javascript Packages Used

Built on the shoulders of giants, this package utilizes a variety of existing javascript packages

About

A Macaulay2 (https://github.com/Macaulay2/M2) package to help visualize algebraic objects in the browser using javascript.


Languages

Language:JavaScript 70.8%Language:Macaulay2 19.5%Language:HTML 8.5%Language:CSS 1.0%Language:CoffeeScript 0.3%Language:Ruby 0.0%