forked from brenden/ukkonen-animation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setting up basic outline for visualization app
- Loading branch information
Showing
5 changed files
with
56 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
elm-stuff | ||
index.html | ||
elm.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module UkkonenVisualization (..) where | ||
|
||
import Html exposing (pre, text) | ||
import Html.Attributes exposing (class) | ||
import Graphics.Element exposing (show) | ||
import Json.Encode as Json | ||
import Window | ||
import UkkonenTree exposing (..) | ||
import UkkonenAlgorithm exposing (..) | ||
|
||
|
||
port tree : Signal Json.Value | ||
port tree = | ||
Signal.map (\( w, h ) -> Json.list [ Json.int w, Json.int h ]) Window.dimensions | ||
|
||
|
||
main = | ||
let | ||
string = "abcabxabcd" | ||
|
||
tree = UkkonenAlgorithm.buildTree string | ||
in | ||
pre [] [ text (UkkonenTree.toString tree) ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<html> | ||
<head> | ||
<title>Ukkonen's algorithm for linear-time suffix tree construction</title> | ||
<script src="elm.js"></script> | ||
<style> | ||
#ukkonen-visualization { | ||
height: 100%; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<h1>foo</h1> | ||
<div id="tree-graph"></div> | ||
<div id="ukkonen-visualization"></div> | ||
</body> | ||
|
||
<script type="text/javascript"> | ||
// Show the stamp module in the "elm-stamps" div. | ||
var div = document.getElementById('ukkonen-visualization'); | ||
var ukkonenVisualization = Elm.embed(Elm.UkkonenVisualization, div); | ||
var treeGraph = document.getElementById('tree-graph'); | ||
|
||
ukkonenVisualization.ports.tree.subscribe(function(tree) { | ||
treeGraph.innerHTML = tree; | ||
}); | ||
</script> | ||
</html> |