Skip to content

Commit

Permalink
Assorted style improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
brenden committed May 22, 2016
1 parent 8312ed0 commit 9aefdf7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
6 changes: 2 additions & 4 deletions UkkonenVisualization.elm
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,12 @@ stringUpdates =

leftButton : Bool -> Html
leftButton enabled =
Html.button [ onClick currentStepUpdates.address Back, disabled <| not enabled ] [ text "" ]
Html.button [ onClick currentStepUpdates.address Back, disabled <| not enabled ] [ text "" ]


rightButton : Bool -> Html
rightButton enabled =
Html.button [ onClick currentStepUpdates.address Forward, disabled <| not enabled ] [ text "" ]
Html.button [ onClick currentStepUpdates.address Forward, disabled <| not enabled ] [ text "" ]


currentStepUpdates : Signal.Mailbox Action
Expand Down Expand Up @@ -180,8 +180,6 @@ introText =
[Ukkonen's algorithm](https://en.wikipedia.org/wiki/Ukkonen's_algorithm) is a method of constructing the [suffix tree](https://en.wikipedia.org/wiki/Suffix_tree) of a string in linear time. Suffix trees are useful because they can efficiently answer many questions about a string, such as how many times a given substring occurs within the string. Enter an input string below and you'll be able to watch step-by-step as Ukkonen's algorithm builds a suffix tree.
I was inspired to build this visualization after reading [this great explanation](http://stackoverflow.com/a/9513423) of Ukkonen's algorithm. I'd recommend first reading that for an overview of how the algorithm works and then playing around with this visualization. Also quite helpful is the explanation given in [this video](https://www.youtube.com/watch?v=aPRqocoBsFQ).
This page was created using [Elm](http://elm-lang.org) and [d3](https://d3js.org/). Here's the [source code](https://github.com/brenden/ukkonen-animation).
"""


Expand Down
13 changes: 6 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,8 @@
var treeGraph = document.getElementById('tree-graph');

// Set up d3 tree visualization
var margin = {top: 20, right: 20, bottom: 10, left: 20};
var width = 960 - margin.right - margin.left;
var height = 700 - margin.top - margin.bottom;
var width = 760;
var height = 600;
var duration = 750;
var tree = d3.layout.tree()
.size([height, width])
Expand All @@ -72,10 +71,10 @@
});

var svg = d3.select("#steps-wrapper").append("svg")
.attr("width", width + margin.right + margin.left)
.attr("height", height + margin.top + margin.bottom)
.attr("width", width)
.attr("height", height)
.append("g")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
.attr("transform", "translate(20,0)");

var suffixLinkGroup = svg.append("g")
.attr("class", "suffix-link-group");
Expand Down Expand Up @@ -342,7 +341,7 @@
.select("text > tspan:nth-child(2)")
.text(function(d) {
if (d.target.childNumber == d.source.activeEdgeChild) {
return ""
return "|"
} else {
return "";
}
Expand Down
5 changes: 3 additions & 2 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ a:hover {

p {
line-height: 20px;
font-size: .9em;
}

button {
Expand Down Expand Up @@ -54,7 +55,7 @@ svg {

#heading {
background-color: #F9F9F9;
padding: 20px;
padding: 10px 0 10px 20px;
border-bottom: 1px solid #999999;
}

Expand All @@ -65,7 +66,7 @@ svg {
}

#heading p {
width: 760px;
width: 770px;
}

#navigation {
Expand Down

0 comments on commit 9aefdf7

Please sign in to comment.