diff --git a/implementation-doc/AlgorithmTab.html b/implementation-doc/AlgorithmTab.html new file mode 100644 index 0000000..0445853 --- /dev/null +++ b/implementation-doc/AlgorithmTab.html @@ -0,0 +1,594 @@ + + + + + JSDoc: Class: AlgorithmTab + + + + + + + + + + +
+ +

Class: AlgorithmTab

+ + + + + + +
+ +
+ +

AlgorithmTab

+ + +
+ +
+
+ + + + + +

new AlgorithmTab()

+ + + + + +
+ Tab for an algorithm +initializes the buttons, callbacks, the logger and fast forward funcitonality +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Adrian Haarbach
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(inner) fastForwardSpeed :Number

+ + + + +
+ Timeout speed in milliseconds for fast forward +
+ + + +
Type:
+
    +
  • + +Number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) logger :Logger

+ + + + +
+ the logger instance +
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

fastForwardAlgorithm()

+ + + + + +
+ "Spult vor", führt den Algorithmus mit hoher Geschwindigkeit aus. +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

init()

+ + + + + +
+ Initialisiert das Zeichenfeld +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

stopFastForward()

+ + + + + +
+ Stoppt das automatische Abspielen des Algorithmus +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/GoldbergTarjanPushRelabelAlgorithm.html b/implementation-doc/GoldbergTarjanPushRelabelAlgorithm.html new file mode 100644 index 0000000..46d355a --- /dev/null +++ b/implementation-doc/GoldbergTarjanPushRelabelAlgorithm.html @@ -0,0 +1,3284 @@ + + + + + JSDoc: Class: GoldbergTarjanPushRelabelAlgorithm + + + + + + + + + + +
+ +

Class: GoldbergTarjanPushRelabelAlgorithm

+ + + + + + +
+ +
+ +

GoldbergTarjanPushRelabelAlgorithm

+ + +
+ +
+
+ + + + + +

new GoldbergTarjanPushRelabelAlgorithm()

+ + + + + +
+ Goldberg Tarjan's Push-Relabel Algorithmus +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Adrian Haarbach
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(inner) debugConsole

+ + + + +
+ debug states for replay steps to console +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) logger :Logger

+ + + + +
+ the logger instance +
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) replayHistory :Array

+ + + + +
+ Replay stack, saves all states of the algorithm for rewinding. +
+ + + +
Type:
+
    +
  • + +Array + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) residualGraphDrawer

+ + + + +
+ The canvas to draw the residual graph with height and excess axes +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) s :Object

+ + + + +
+ status variables +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) that :GoldbergTarjanPushRelabelAlgorithm

+ + + + +
+ closure variables for this class +
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

activate()

+ + + + + +
+ tab comes into view +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

addReplayStep()

+ + + + + +
+ add a step to the replay stack, serialize stateful data +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

deactivate()

+ + + + + +
+ tab disappears from view +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

edgeText()

+ + + + + +
+ Displays in the middle of the edge (typically cost/resource vectors or capacity/flow) +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

getState()

+ + + + + +
+ getter for status variable +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

init()

+ + + + + +
+ Init the graph network visualization as well as the secondary visualizaiton layer +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

nextStepChoice()

+ + + + + +
+ Executes the next step in the algorithm +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

nodeLabel()

+ + + + + +
+ Displays inside of a node (typically its id) +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

nodeText()

+ + + + + +
+ Displays on top of a node (typically constraints or state variables) +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

nodeX()

+ + + + + +
+ X Position of a node +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

nodeY()

+ + + + + +
+ Y Position of a node +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

onEdgesEntered()

+ + + + + +
+ Called when new edges are entering +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

onEdgesUpdated()

+ + + + + +
+ Called when exisitng edges are updated +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

onNodesEntered()

+ + + + + +
+ Called when new nodes are entering +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

onNodesUpdated()

+ + + + + +
+ Called when exisitng nodes are updated +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

previousStepChoice()

+ + + + + +
+ playback the last step from stack, deserialize stateful data +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

reset()

+ + + + + +
+ Clear all states +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

update()

+ + + + + +
+ make the view consistent with the state +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

updateDescriptionAndPseudocode()

+ + + + + +
+ updates status description and pseudocode highlight based on current s.id +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

updateEdges()

+ + + + + +
+ D3's Data Join of edge data with their visualization (lines) +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

updateNodes()

+ + + + + +
+ D3's Data Join of node data with their visualization (circles) +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) admissiblePush()

+ + + + + +
+ checks if we can apply a push operation. Together with push() mimics the inner WHILE loop +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) admissibleRelabel()

+ + + + + +
+ checks if we can apply a relabel operation. This mimics and IF, since relabel() returns to outer while loop +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) flowWidth()

+ + + + + +
+ thickness of edges depending on flow going through +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) initDistanceFunction()

+ + + + + +
+ initialize the distance function +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) initPreflow()

+ + + + + +
+ initialize the preflow +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) mainLoop()

+ + + + + +
+ main loop: pops the current node from the queue until empty +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) push()

+ + + + + +
+ apply a push operation on the current node +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) relabel()

+ + + + + +
+ apply a relabel operation on the current node +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) selectSource()

+ + + + + +
+ select the source node +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) selectTarget()

+ + + + + +
+ select the target node +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) updateResidualEdgesForwardStar()

+ + + + + +
+ playback the last step from stack, deserialize stateful data +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/Graph.Edge.html b/implementation-doc/Graph.Edge.html new file mode 100644 index 0000000..cd0ee95 --- /dev/null +++ b/implementation-doc/Graph.Edge.html @@ -0,0 +1,298 @@ + + + + + JSDoc: Class: Edge + + + + + + + + + + +
+ +

Class: Edge

+ + + + + + +
+ +
+ +

+ Graph.Edge

+ + +
+ +
+
+ + + + + +

new Edge()

+ + + + + +
+ Represents a graph edge +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

toString(full)

+ + + + + +
+ Returns a string representation of this edge together with its resources +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
full + + +boolean + + + + wheater to include the start and end node ids in the form start->end
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/Graph.Label.html b/implementation-doc/Graph.Label.html new file mode 100644 index 0000000..789be98 --- /dev/null +++ b/implementation-doc/Graph.Label.html @@ -0,0 +1,345 @@ + + + + + JSDoc: Class: Label + + + + + + + + + + +
+ +

Class: Label

+ + + + + + +
+ +
+ +

+ Graph.Label

+ + +
+ +
+
+ + + + + +

new Label()

+ + + + + +
+ A Label, built as a tree starting from the primitive label + +A label for an SPPRC labelling algorithm stores its resident vertex, its predecessor arc over +which it has been extended, its predecessor label, and its current vector of resource values. The +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

(static) extend()

+ + + + + +
+ Static factory function +extends a label along the arc and returns a new label +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ Label +
+ + + + + + + + + + + + +

(static) feasible()

+ + + + + +
+ Checks weather a label fulfills all its resource constraints in its resident node +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/Graph.Node.html b/implementation-doc/Graph.Node.html new file mode 100644 index 0000000..979f20f --- /dev/null +++ b/implementation-doc/Graph.Node.html @@ -0,0 +1,620 @@ + + + + + JSDoc: Class: Node + + + + + + + + + + +
+ +

Class: Node

+ + + + + + +
+ +
+ +

+ Graph.Node

+ + +
+ +
+
+ + + + + +

new Node(x, y, id)

+ + + + + +
+ Represents a graph node +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +number + + + + the horizontal position
y + + +number + + + + the vertical position
id + + +number + + + + a unique id
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

getInEdges()

+ + + + + +
+ Incoming edges of the node. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ [Graph.Edge] +
+ + + + + + + + + + + + +

getOutEdges()

+ + + + + +
+ Outgoing edges of the node. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ [Graph.Edge] +
+ + + + + + + + + + + + +

toString(full, fopt)

+ + + + + +
+ Returns a string representation of this node together with its resources +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
full + + +boolean + + + + + + + + + + wheater to include the id
f + + +function + + + + + + <optional>
+ + + + + +
optional resource accessor function
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/Graph.ResidualEdge.html b/implementation-doc/Graph.ResidualEdge.html new file mode 100644 index 0000000..9f010ef --- /dev/null +++ b/implementation-doc/Graph.ResidualEdge.html @@ -0,0 +1,495 @@ + + + + + JSDoc: Class: ResidualEdge + + + + + + + + + + +
+ +

Class: ResidualEdge

+ + + + + + +
+ +
+ +

+ Graph.ResidualEdge

+ +
Represents a residual edge in the residual Graph G'
+ + +
+ +
+
+ + + + +

Constructor

+ + +

new ResidualEdge()

+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

c_dash()

+ + + + + +
+ The residual capacity +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

edge()

+ + + + + +
+ The original edge of the graph G +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

end()

+ + + + + +
+ The end vertex +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

start()

+ + + + + +
+ The start vertex +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/Graph.html b/implementation-doc/Graph.html new file mode 100644 index 0000000..7b7dd19 --- /dev/null +++ b/implementation-doc/Graph.html @@ -0,0 +1,1386 @@ + + + + + JSDoc: Class: Graph + + + + + + + + + + +
+ +

Class: Graph

+ + + + + + +
+ +
+ +

Graph

+ +
Represents a graph. +Also acts as namespace for Graph.Node, Graph.Edge as well as static variables and functions.
+ + +
+ +
+
+ + + + +

Constructor

+ + +

new Graph()

+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + +

Classes

+ +
+
Edge
+
+ +
Label
+
+ +
Node
+
+ +
ResidualEdge
+
+
+ + + + + + + +

Members

+ + + +

(static) instance

+ + + + +
+ Singleton to have just one Graph instance per app. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

(static) addChangeListener()

+ + + + + +
+ Add callback functions to be executed after a graph was loaded asynchronically, e.g. to initialize the application +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) handleFileSelect()

+ + + + + +
+ Upload graph file from a local computer +using HTML5 FileReader feature +calls setInstance async. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) loadInstance()

+ + + + + +
+ Ajax graph file loading from a server +using d3.text instead of raw ajax calls +calls setInstance async. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) parse(text) → {Graph}

+ + + + + +
+ Graph parser static factory method +constructs a Graph object from a textuatl representation of the graph. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
text + + +String + + + + sequentialized Graph
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ - parsed Graph object +
+ + + +
+
+ Type +
+
+ +Graph + + +
+
+ + + + + + + + + + +

(static) setInstance()

+ + + + + +
+ Replace the current graph singleton instance and call the defined callback functions. +This function is both called asyncronically from within ajax loading of graphs from servers and from local file uploads. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(static) stringify(graphopt) → {String}

+ + + + + +
+ Graph serializer static method +Serialize a graph with all resources to string, used when downloading a graph. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeAttributesDescription
graph + + +Graph + + + + + + <optional>
+ + + + + +
Graph object. If not given the current Graph.instance is used
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + +
Returns:
+ + +
+ text - sequentialized Graph +
+ + + +
+
+ Type +
+
+ +String + + +
+
+ + + + + + + + + + +

(static) styleResources()

+ + + + + +
+ Style node or edge resources +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

addEdge(id, id)

+ + + + + +
+ Add an edge to the graph +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
id + + +Number +| + +String + + + + of start node
id + + +Number +| + +String + + + + of end node
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

addNode(x, y)

+ + + + + +
+ add a node to the graph +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
x + + +Number +| + +String + + + + coordinate
y + + +Number +| + +String + + + + coordinate
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

getNodeResourcesSize()

+ + + + + +
+ We allow arbitrary size of resources for each node. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/GraphDrawer.html b/implementation-doc/GraphDrawer.html new file mode 100644 index 0000000..162f7b5 --- /dev/null +++ b/implementation-doc/GraphDrawer.html @@ -0,0 +1,1151 @@ + + + + + JSDoc: Class: GraphDrawer + + + + + + + + + + +
+ +

Class: GraphDrawer

+ + + + + + +
+ +
+ +

GraphDrawer

+ +
The base class of a Network visualization of a graph. Based on D3 and SVG. +Graph Editors and Graph Algorithms should inherit from this class.
+ + +
+ +
+
+ + + + +

Constructor

+ + +

new GraphDrawer()

+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

edgeText()

+ + + + + +
+ Displays in the middle of the edge (typically cost/resource vectors or capacity/flow) +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

nodeLabel()

+ + + + + +
+ Displays inside of a node (typically its id) +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

nodeText()

+ + + + + +
+ Displays on top of a node (typically constraints or state variables) +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

nodeX()

+ + + + + +
+ X Position of a node +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

nodeY()

+ + + + + +
+ Y Position of a node +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

onEdgesEntered()

+ + + + + +
+ Called when new edges are entering +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

onEdgesUpdated()

+ + + + + +
+ Called when exisitng edges are updated +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

onNodesEntered()

+ + + + + +
+ Called when new nodes are entering +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

onNodesUpdated()

+ + + + + +
+ Called when exisitng nodes are updated +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

update()

+ + + + + +
+ The main function which triggers updates to node and edge selections. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

updateEdges()

+ + + + + +
+ D3's Data Join of edge data with their visualization (lines) +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

updateNodes()

+ + + + + +
+ D3's Data Join of node data with their visualization (circles) +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/GraphEditorTab.html b/implementation-doc/GraphEditorTab.html new file mode 100644 index 0000000..33a8cfa --- /dev/null +++ b/implementation-doc/GraphEditorTab.html @@ -0,0 +1,1276 @@ + + + + + JSDoc: Class: GraphEditorTab + + + + + + + + + + +
+ +

Class: GraphEditorTab

+ + + + + + +
+ +
+ +

GraphEditorTab

+ + +
+ +
+
+ + + + + +

new GraphEditorTab()

+ + + + + +
+ A graph editor in a Tab +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Adrian Haarbach
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

active :Boolean

+ + + + +
+ Zeigt an, ob der Tab z.Zt. aktiv ist (ungenutzt) +
+ + + +
Type:
+
    +
  • + +Boolean + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

statusBackup :String

+ + + + +
+ HTML des Tabs vor dem Öffnen des Tabs +
+ + + +
Type:
+
    +
  • + +String + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

tab :Object

+ + + + +
+ jQuery Objekt des aktuellen Tabs +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

_activate()

+ + + + + +
+ when tab is openend +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

_deactivate()

+ + + + + +
+ when tab is closed +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

_init()

+ + + + + +
+ Initialisiert das Zeichenfeld +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

activate()

+ + + + + +
+ When Tab comes into view we update the view +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

animateLegende()

+ + + + + +
+ Animiert die Legende: Buttons zum maximieren / minimieren, Icons in den +Buttons, Tooltipp für Vorgängerkante +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

init()

+ + + + + +
+ Wires up the events on button clicks or selection changes and listens to a Graph change event +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

maximizeLegend()

+ + + + + +
+ Maximiert die Legende und positioniert sie korrekt. +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

minimizeLegend()

+ + + + + +
+ Minimiert die Legende und positioniert sie korrekt. +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

openDialogs()

+ + + + + +
+ Öffnet die Dialoge, die zu dem Tab gehören: Eingangsdialog und mglw. +Abfrage, ob man den Tab wirklich verlassen möchte. +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

setGraphHandler()

+ + + + + +
+ A different example graph was selected. Triggers the loader +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/LabelDrawer.html b/implementation-doc/LabelDrawer.html new file mode 100644 index 0000000..9d15bc6 --- /dev/null +++ b/implementation-doc/LabelDrawer.html @@ -0,0 +1,162 @@ + + + + + JSDoc: Class: LabelDrawer + + + + + + + + + + +
+ +

Class: LabelDrawer

+ + + + + + +
+ +
+ +

LabelDrawer

+ +
Secondary visualization layer to draw labels
+ + +
+ +
+
+ + + + +

Constructor

+ + +

new LabelDrawer()

+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/Logger.html b/implementation-doc/Logger.html new file mode 100644 index 0000000..afe2402 --- /dev/null +++ b/implementation-doc/Logger.html @@ -0,0 +1,218 @@ + + + + + JSDoc: Class: Logger + + + + + + + + + + +
+ +

Class: Logger

+ + + + + + +
+ +
+ +

Logger

+ + +
+ +
+
+ + + + + +

new Logger(parentDiv)

+ + + + + +
+ Writes to the Log tab in the algorithm +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
parentDiv + + +Object + + + + a d3 selector
+ + + + + + +
+ + + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Adrian Haarbach
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/ResidualGraphDrawer.html b/implementation-doc/ResidualGraphDrawer.html new file mode 100644 index 0000000..accefa6 --- /dev/null +++ b/implementation-doc/ResidualGraphDrawer.html @@ -0,0 +1,412 @@ + + + + + JSDoc: Class: ResidualGraphDrawer + + + + + + + + + + +
+ +

Class: ResidualGraphDrawer

+ + + + + + +
+ +
+ +

ResidualGraphDrawer

+ +
Secondary visualization layer to draw the residual graph
+ + +
+ +
+
+ + + + +

Constructor

+ + +

new ResidualGraphDrawer()

+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + + +

Methods

+ + + + + + +

edgeText()

+ + + + + +
+ Edge text is capacity c' of residual edges e' in G' +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

onNodesEntered()

+ + + + + +
+ Add Rectangle(excessBar) and Text (height,excess) to nodes. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

onNodesUpdated()

+ + + + + +
+ Update Rectangle(excessBar) and Text (height,excess) at nodes. Display of these depends on current selected xFunName +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/SPPRCLabelSettingAlgorithm.html b/implementation-doc/SPPRCLabelSettingAlgorithm.html new file mode 100644 index 0000000..a125624 --- /dev/null +++ b/implementation-doc/SPPRCLabelSettingAlgorithm.html @@ -0,0 +1,2833 @@ + + + + + JSDoc: Class: SPPRCLabelSettingAlgorithm + + + + + + + + + + +
+ +

Class: SPPRCLabelSettingAlgorithm

+ + + + + + +
+ +
+ +

SPPRCLabelSettingAlgorithm

+ + +
+ +
+
+ + + + + +

new SPPRCLabelSettingAlgorithm()

+ + + + + +
+ SPPRC Label Setting Algorithm +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Adrian Haarbach
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + +

Extends

+ + + + + + + + + + + + + + + + + + +

Members

+ + + +

(inner) logger :Logger

+ + + + +
+ the logger instance +
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) replayHistory :Array

+ + + + +
+ Replay Stack, speichert alle Schritte des Ablaufs für Zurück Button +
+ + + +
Type:
+
    +
  • + +Array + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) s :Object

+ + + + +
+ status variables +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) that :SPPRCLabelSettingAlgorithm

+ + + + +
+ closure for this class +
+ + + +
Type:
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

activate()

+ + + + + +
+ When Tab comes into view +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

addReplayStep()

+ + + + + +
+ add a step to the replay stack, serialize stateful data +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

deactivate()

+ + + + + +
+ tab disappears from view +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

edgeText()

+ + + + + +
+ Displays in the middle of the edge (typically cost/resource vectors or capacity/flow) +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

filter()

+ + + + + +
+ discard strictly dominated labels in both P and U +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

init()

+ + + + + +
+ Initialisiert das Zeichenfeld +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

nextStepChoice()

+ + + + + +
+ Executes the next step in the algorithm +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

nodeLabel()

+ + + + + +
+ Displays inside of a node (typically its id) +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

nodeText()

+ + + + + +
+ Displays on top of a node (typically constraints or state variables) +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

nodeX()

+ + + + + +
+ X Position of a node +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

nodeY()

+ + + + + +
+ Y Position of a node +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

onEdgesEntered()

+ + + + + +
+ Called when new edges are entering +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

onEdgesUpdated()

+ + + + + +
+ Called when exisitng edges are updated +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

onNodesEntered()

+ + + + + +
+ Called when new nodes are entering +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

onNodesUpdated()

+ + + + + +
+ Called when exisitng nodes are updated +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

previousStepChoice()

+ + + + + +
+ playback the last step from stack, deserialize stateful data +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

reset()

+ + + + + +
+ clear all states +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

selectSource()

+ + + + + +
+ select the source node +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

update()

+ + + + + +
+ Makes the view consistent with the state +
+ + + + + + + + + + + + + +
+ + + + + + + + +
Overrides:
+
+ + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

updateDescriptionAndPseudocode()

+ + + + + +
+ updates status description and pseudocode highlight based on current s.id +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

updateEdges()

+ + + + + +
+ D3's Data Join of edge data with their visualization (lines) +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

updateNodes()

+ + + + + +
+ D3's Data Join of node data with their visualization (circles) +
+ + + + + + + + + + + + + +
+ + + + + + +
Inherited From:
+
+ + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) dominance()

+ + + + + +
+ discard strictly dominated labels in both P and U +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) initLabels()

+ + + + + +
+ init the label queue / sets with the +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) labelProcessed()

+ + + + + +
+ put processed label in P +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) mainLoop()

+ + + + + +
+ main loop: pops the current node from the queue until empty +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) pathExtend()

+ + + + + +
+ try to extend currentLabel along currentArc +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

(inner) pathExtendFeasible()

+ + + + + +
+ Check if the previous label extension was feasible. +if yes, put it in U, else discard it +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/Tab.html b/implementation-doc/Tab.html new file mode 100644 index 0000000..b34afd6 --- /dev/null +++ b/implementation-doc/Tab.html @@ -0,0 +1,1545 @@ + + + + + JSDoc: Class: Tab + + + + + + + + + + +
+ +

Class: Tab

+ + + + + + +
+ +
+ +

Tab

+ + +
+ +
+
+ + + + + +

new Tab(algo, p_tab)

+ + + + + +
+ A Tab in the view. Wires together the legend and calls algo's activation functions. +
+ + + + + + + + + +
Parameters:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
algo + + +GraphDrawer + + + + Instance of an algorithm. Must have interface methods : init, activate, deactivate
p_tab + + +Object + + + + Jquery tab elector
+ + + + + + +
+ + + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Adrian Haarbach
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + +

Members

+ + + +

active :Boolean

+ + + + +
+ Zeigt an, ob der Tab z.Zt. aktiv ist (ungenutzt) +
+ + + +
Type:
+
    +
  • + +Boolean + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

statusBackup :String

+ + + + +
+ HTML des Tabs vor dem Öffnen des Tabs +
+ + + +
Type:
+
    +
  • + +String + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

tab :Object

+ + + + +
+ jQuery Objekt des aktuellen Tabs +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) legendeMax :Object

+ + + + +
+ jQuery Objekt der maximierten Legende +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) legendeMaxButton :Object

+ + + + +
+ jQuery Objekt des "Maximieren" Buttons de Legende im aktuellen Tab +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) legendeMin :Object

+ + + + +
+ jQuery Objekt der minimierten Legende +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) legendeMinButton :Object

+ + + + +
+ jQuery Objekt des "Minimieren" Buttons de Legende im aktuellen Tab +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) statusWindow :Object

+ + + + +
+ jQuery Objekt des statusFensters des Tabs +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) tabChangeWarningDialog :Object

+ + + + +
+ jQuery Objekt des Dialogs, der zu Beginn des Tabs gezeigt wird. +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

(inner) tabIntroDialog :Object

+ + + + +
+ jQuery Objekt des Dialogs, der zu Beginn des Tabs gezeigt wird. +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

_activate()

+ + + + + +
+ when tab is openend +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

_deactivate()

+ + + + + +
+ when tab is closed +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

_init()

+ + + + + +
+ Initialisiert das Zeichenfeld +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

animateLegende()

+ + + + + +
+ Animiert die Legende: Buttons zum maximieren / minimieren, Icons in den +Buttons, Tooltipp für Vorgängerkante +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

maximizeLegend()

+ + + + + +
+ Maximiert die Legende und positioniert sie korrekt. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

minimizeLegend()

+ + + + + +
+ Minimiert die Legende und positioniert sie korrekt. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

openDialogs()

+ + + + + +
+ Öffnet die Dialoge, die zu dem Tab gehören: Eingangsdialog und mglw. +Abfrage, ob man den Tab wirklich verlassen möchte. +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/fonts/OpenSans-Bold-webfont.eot b/implementation-doc/fonts/OpenSans-Bold-webfont.eot new file mode 100644 index 0000000..5d20d91 Binary files /dev/null and b/implementation-doc/fonts/OpenSans-Bold-webfont.eot differ diff --git a/implementation-doc/fonts/OpenSans-Bold-webfont.svg b/implementation-doc/fonts/OpenSans-Bold-webfont.svg new file mode 100644 index 0000000..3ed7be4 --- /dev/null +++ b/implementation-doc/fonts/OpenSans-Bold-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/implementation-doc/fonts/OpenSans-Bold-webfont.woff b/implementation-doc/fonts/OpenSans-Bold-webfont.woff new file mode 100644 index 0000000..1205787 Binary files /dev/null and b/implementation-doc/fonts/OpenSans-Bold-webfont.woff differ diff --git a/implementation-doc/fonts/OpenSans-BoldItalic-webfont.eot b/implementation-doc/fonts/OpenSans-BoldItalic-webfont.eot new file mode 100644 index 0000000..1f639a1 Binary files /dev/null and b/implementation-doc/fonts/OpenSans-BoldItalic-webfont.eot differ diff --git a/implementation-doc/fonts/OpenSans-BoldItalic-webfont.svg b/implementation-doc/fonts/OpenSans-BoldItalic-webfont.svg new file mode 100644 index 0000000..6a2607b --- /dev/null +++ b/implementation-doc/fonts/OpenSans-BoldItalic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/implementation-doc/fonts/OpenSans-BoldItalic-webfont.woff b/implementation-doc/fonts/OpenSans-BoldItalic-webfont.woff new file mode 100644 index 0000000..ed760c0 Binary files /dev/null and b/implementation-doc/fonts/OpenSans-BoldItalic-webfont.woff differ diff --git a/implementation-doc/fonts/OpenSans-Italic-webfont.eot b/implementation-doc/fonts/OpenSans-Italic-webfont.eot new file mode 100644 index 0000000..0c8a0ae Binary files /dev/null and b/implementation-doc/fonts/OpenSans-Italic-webfont.eot differ diff --git a/implementation-doc/fonts/OpenSans-Italic-webfont.svg b/implementation-doc/fonts/OpenSans-Italic-webfont.svg new file mode 100644 index 0000000..e1075dc --- /dev/null +++ b/implementation-doc/fonts/OpenSans-Italic-webfont.svg @@ -0,0 +1,1830 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/implementation-doc/fonts/OpenSans-Italic-webfont.woff b/implementation-doc/fonts/OpenSans-Italic-webfont.woff new file mode 100644 index 0000000..ff652e6 Binary files /dev/null and b/implementation-doc/fonts/OpenSans-Italic-webfont.woff differ diff --git a/implementation-doc/fonts/OpenSans-Light-webfont.eot b/implementation-doc/fonts/OpenSans-Light-webfont.eot new file mode 100644 index 0000000..1486840 Binary files /dev/null and b/implementation-doc/fonts/OpenSans-Light-webfont.eot differ diff --git a/implementation-doc/fonts/OpenSans-Light-webfont.svg b/implementation-doc/fonts/OpenSans-Light-webfont.svg new file mode 100644 index 0000000..11a472c --- /dev/null +++ b/implementation-doc/fonts/OpenSans-Light-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/implementation-doc/fonts/OpenSans-Light-webfont.woff b/implementation-doc/fonts/OpenSans-Light-webfont.woff new file mode 100644 index 0000000..e786074 Binary files /dev/null and b/implementation-doc/fonts/OpenSans-Light-webfont.woff differ diff --git a/implementation-doc/fonts/OpenSans-LightItalic-webfont.eot b/implementation-doc/fonts/OpenSans-LightItalic-webfont.eot new file mode 100644 index 0000000..8f44592 Binary files /dev/null and b/implementation-doc/fonts/OpenSans-LightItalic-webfont.eot differ diff --git a/implementation-doc/fonts/OpenSans-LightItalic-webfont.svg b/implementation-doc/fonts/OpenSans-LightItalic-webfont.svg new file mode 100644 index 0000000..431d7e3 --- /dev/null +++ b/implementation-doc/fonts/OpenSans-LightItalic-webfont.svg @@ -0,0 +1,1835 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/implementation-doc/fonts/OpenSans-LightItalic-webfont.woff b/implementation-doc/fonts/OpenSans-LightItalic-webfont.woff new file mode 100644 index 0000000..43e8b9e Binary files /dev/null and b/implementation-doc/fonts/OpenSans-LightItalic-webfont.woff differ diff --git a/implementation-doc/fonts/OpenSans-Regular-webfont.eot b/implementation-doc/fonts/OpenSans-Regular-webfont.eot new file mode 100644 index 0000000..6bbc3cf Binary files /dev/null and b/implementation-doc/fonts/OpenSans-Regular-webfont.eot differ diff --git a/implementation-doc/fonts/OpenSans-Regular-webfont.svg b/implementation-doc/fonts/OpenSans-Regular-webfont.svg new file mode 100644 index 0000000..25a3952 --- /dev/null +++ b/implementation-doc/fonts/OpenSans-Regular-webfont.svg @@ -0,0 +1,1831 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/implementation-doc/fonts/OpenSans-Regular-webfont.woff b/implementation-doc/fonts/OpenSans-Regular-webfont.woff new file mode 100644 index 0000000..e231183 Binary files /dev/null and b/implementation-doc/fonts/OpenSans-Regular-webfont.woff differ diff --git a/implementation-doc/global.html b/implementation-doc/global.html new file mode 100644 index 0000000..ebc788d --- /dev/null +++ b/implementation-doc/global.html @@ -0,0 +1,653 @@ + + + + + JSDoc: Global + + + + + + + + + + +
+ +

Global

+ + + + + + +
+ +
+ +

+ + +
+ +
+
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + + + + + + + + + +

Members

+ + + +

const_Colors :Object

+ + + + +
+ Die Farben, die im Projekt genutzt werden. +Aus dem TUM Styleguide. +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

global_Edgelayout :Object

+ + + + +
+ Standardaussehen einer Kante. +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

global_KnotenRadius :Number

+ + + + +
+ Standardgröße eines Knotens +
+ + + +
Type:
+
    +
  • + +Number + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

global_NodeLayout :Object

+ + + + +
+ Standardaussehen eines Knotens. +
+ + + +
Type:
+
    +
  • + +Object + + +
  • +
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + +

GraphAlgos

+ + + + +
+ Global map where we save the GraphDrawer instances. Used when saving svg to disc. +
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + +

Methods

+ + + + + + +

initializeSiteLayout()

+ + + + + +
+ Initializes the page layout of all interactive tabs +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Adrian Haarbach
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +

translate()

+ + + + + +
+ Helper function to return a string representaiton of SVG's translate tranform +
+ + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/index.html b/implementation-doc/index.html new file mode 100644 index 0000000..017cc49 --- /dev/null +++ b/implementation-doc/index.html @@ -0,0 +1,170 @@ + + + + + JSDoc: Home + + + + + + + + + + +
+ +

Home

+ + + + + + + + +

+ + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +

library-d3-svg/js/Graph.js

+ + +
+ +
+
+ + +
This file contains just our basic graph model, +together with methods to parse and sequentialize the graph.
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
Author:
+
+
    +
  • Adrian Haarbach
  • +
+
+ + + + + + + + + +
Source:
+
+ + + + + + + +
+ + + + +
+ + + + +

Requires

+ +
    +
  • module:d3.map,
  • +
+ + + + + + + + + + + + + + + +
+ +
+ + + + +
+ + + +
+ + + + + + + \ No newline at end of file diff --git a/implementation-doc/library-d3-svg_js_AlgorithmTab.js.html b/implementation-doc/library-d3-svg_js_AlgorithmTab.js.html new file mode 100644 index 0000000..48c3f7f --- /dev/null +++ b/implementation-doc/library-d3-svg_js_AlgorithmTab.js.html @@ -0,0 +1,196 @@ + + + + + JSDoc: Source: library-d3-svg/js/AlgorithmTab.js + + + + + + + + + + +
+ +

Source: library-d3-svg/js/AlgorithmTab.js

+ + + + + + +
+
+
/**
+ * Tab for an algorithm
+ * initializes the buttons, callbacks, the logger and fast forward funcitonality
+ * @author Adrian Haarbach
+ * @augments AlgorithmTab
+ * @class
+ */
+function AlgorithmTab(algo,p_tab) {
+    Tab.call(this, algo, p_tab);
+
+    /**
+     * ID of the fast forward interval
+     * @type Number
+     */
+    algo.fastForwardIntervalID = null;
+
+    var that = this;
+
+    /**
+     * Timeout speed in milliseconds for fast forward
+     * @type Number
+     */
+    var fastForwardSpeed = 5;
+
+    /**
+     * the logger instance
+     * @type Logger
+     */
+    var logger = new Logger(d3.select("#logger"));
+
+
+    var fastforwardOptions = {label: $("#ta_button_text_fastforward").text(), icons: {primary: "ui-icon-seek-next"}};
+
+    /**
+     * Initialisiert das Zeichenfeld
+     * @method
+     */
+    this.init = function() {
+
+        var pauseOptions = {label: $("#ta_button_text_pause").text(), icons: {primary: "ui-icon-pause"}};
+
+        if(algo.rewindStart && algo.rewindStop){
+        var rewindOptions = {label: $("#ta_button_text_rewind").text(), icons: {primary: "ui-icon-seek-prev"}};
+            $("#ta_button_rewind")
+            .button(rewindOptions)
+            .click(function() {
+                $(this).button("option",this.checked ? pauseOptions : rewindOptions);
+                this.checked ? algo.rewindStart() : algo.rewindStop();
+            })
+        }else{
+            $("#ta_button_rewind").hide();
+            $("#ta_button_text_rewind").hide();
+        }
+        
+        $("#ta_button_Zurueck")
+            .button({icons: {primary: "ui-icon-seek-start"}})
+            .click(function() {
+                algo.previousStepChoice();
+            });
+        
+        $("#ta_button_1Schritt")
+            .button({icons: {primary: "ui-icon-seek-end"}})
+            .click(function() {
+                algo.nextStepChoice();
+            });
+
+        $("#ta_button_vorspulen")
+            .button(fastforwardOptions)
+            .click(function() {
+                $(this).button("option",this.checked ? pauseOptions : fastforwardOptions);
+                this.checked ? that.fastForwardAlgorithm() : that.stopFastForward();
+            });
+
+        $("#ta_vorspulen_speed").on("input",function(){
+            fastForwardSpeed=+this.value;  
+        });
+
+
+
+        $("#ta_div_statusTabs").tabs();
+        $("#ta_div_statusTabs").tabs("option", "active", 2);
+
+        $("#ta_tr_LegendeClickable").removeClass("greyedOutBackground");
+        
+        var pseudocode = d3.select("#ta_div_statusPseudocode")
+        var sel = pseudocode.selectAll("div").selectAll("p")
+        sel.attr("class", function(a, pInDivCounter, divCounter) {
+            return "pseudocode";
+        });
+
+        d3.select("#tw_div_statusPseudocode").html(pseudocode.html())
+
+        Tab.prototype.init.call(this);
+
+    };
+
+    /**
+     * "Spult vor", führt den Algorithmus mit hoher Geschwindigkeit aus.
+     * @method
+     */
+    this.fastForwardAlgorithm = function() {
+//         $("#ta_button_1Schritt").button("option", "disabled", true);
+//         $("#ta_button_Zurueck").button("option", "disabled", true);
+//         $("#ta_button_rewind").button("option", "disabled", true);
+//         var geschwindigkeit = 5; // Geschwindigkeit, mit der der Algorithmus ausgeführt wird in Millisekunden
+        
+        algo.fastForwardIntervalID = window.setInterval(function() {
+            algo.nextStepChoice();
+        }, fastForwardSpeed);
+
+        algo.update();
+    };
+
+    /**
+     * Stoppt das automatische Abspielen des Algorithmus
+     * @method
+     */
+    this.stopFastForward = function() {
+//         $("#ta_button_1Schritt").button("option", "disabled", false);
+//         $("#ta_button_Zurueck").button("option", "disabled", false);
+//         $("#ta_button_rewind").button("option", "disabled", false);
+        window.clearInterval(algo.fastForwardIntervalID);
+        algo.fastForwardIntervalID = null;
+        d3.select("#ta_button_vorspulen").property("checked",false);
+        $("#ta_button_vorspulen").button("option",fastforwardOptions);
+        //algo.update();
+    };
+    
+    
+//     this.setDisabledBackward = function(disabled) {
+//         $("#ta_button_Zurueck").button("option", "disabled", disabled);
+//     };
+    
+//     this.setDisabledForward = function(disabled, disabledSpulen) {
+//         var disabledSpulen = (disabledSpulen!==undefined) ? disabledSpulen : disabled;
+//         $("#ta_button_1Schritt").button("option", "disabled", disabled);
+//         $("#ta_button_vorspulen").button("option", "disabled", disabledSpulen);
+//     };
+
+    algo.stopFastForward = this.stopFastForward;
+}
+
+// Vererbung realisieren
+AlgorithmTab.prototype = Object.create(Tab.prototype);
+AlgorithmTab.prototype.constructor = AlgorithmTab;
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/implementation-doc/library-d3-svg_js_Graph.js.html b/implementation-doc/library-d3-svg_js_Graph.js.html new file mode 100644 index 0000000..589a949 --- /dev/null +++ b/implementation-doc/library-d3-svg_js_Graph.js.html @@ -0,0 +1,441 @@ + + + + + JSDoc: Source: library-d3-svg/js/Graph.js + + + + + + + + + + +
+ +

Source: library-d3-svg/js/Graph.js

+ + + + + + +
+
+
/**
+ * @fileOverview
+ * This file contains just our basic graph model, 
+ * together with methods to parse and sequentialize the graph.
+ *
+ * @author Adrian Haarbach
+ *
+ * @requires d3.map, an associative array similar to new Object() / {}
+ */
+
+/**
+ * @classdesc
+ * Represents a graph.
+ * Also acts as namespace for Graph.Node, Graph.Edge as well as static variables and functions.
+ * @constructor
+ */
+function Graph(){
+  //unique id counter for nodes and edges,
+  //increased whenever a node or edge is added to the graph.
+  this.nodeIds=0;
+  this.edgeIds=0;
+  //associative arrays of nodes and edges
+  this.nodes=d3.map();
+  this.edges=d3.map();
+}
+
+/**
+ * Represents a graph node
+ * @constructor
+ * @param {number} x - the horizontal position
+ * @param {number} y - the vertical position
+ * @param {number} id - a unique id
+ */
+Graph.Node = function(x,y,id){
+  this.x=x;
+  this.y=y;
+  this.id=id;
+
+  //arbitrary number of resources or constraints, fixed during runtime
+  this.resources=[];
+  
+  //outgoing and incoming edges are saved to facilitate handling of vertices in algorithms
+  this.outEdges=d3.map();
+  this.inEdges=d3.map();
+
+  //The state changes during algorithm runtime
+  //Should not contain cyclic object dependencies
+  //since we call JSON.stringify on this object in order
+  //to implement the replay functionality.
+  this.state={};
+}
+
+/**
+ * Incoming edges of the node.
+ * @return [Graph.Edge]
+ */
+Graph.Node.prototype.getInEdges = function(){
+  return this.inEdges.values();
+}
+
+/**
+ * Outgoing edges of the node.
+ * @return [Graph.Edge]
+ */
+Graph.Node.prototype.getOutEdges = function(){
+  return this.outEdges.values();
+}
+
+/**
+ * Returns a string representation of this node together with its resources
+ * @param {boolean} full - wheater to include the id
+ * @param {function} [f] - optional resource accessor function
+ */
+Graph.Node.prototype.toString = function(full,f){
+  var str="";
+  if(full) str += this.id+" ";
+  str +=Graph.styleResources(this.resources,"[","]",f);
+  return str;
+}
+
+/**
+ * Represents a graph edge
+ * @constructor
+ */
+Graph.Edge = function(s,t,id){
+  this.start=s;
+  this.end=t;
+  this.id=id;
+  this.resources=[];
+
+  this.state={}; //changes during algorithm runtime
+}
+
+/**
+ * Returns a string representation of this edge together with its resources
+ * @param {boolean} full wheater to include the start and end node ids in the form start->end
+ */
+Graph.Edge.prototype.toString = function(full,f){
+  var str="";
+  if(full) str += this.start.id+"->"+this.end.id+" ";
+  str += Graph.styleResources(this.resources,"(",")",f);
+  return str;
+}
+
+/////////////////
+//MEMBERS
+
+/**
+ * add a node to the graph
+ * @param {Number|String} x coordinate
+ * @param {Number|String} y coordinate
+ */
+Graph.prototype.addNode = function(x,y,resources){
+  var node = new Graph.Node(+x,+y,this.nodeIds++);
+  node.resources=resources || [];
+  for(var i = 0, toAdd = this.getNodeResourcesSize() - node.resources.length; i<toAdd; i++){
+    node.resources.push(0);
+  }
+  this.nodes.set(node.id,node);
+  return node;
+}
+
+Graph.prototype.addNodeDirectly = function(node){
+  node.id = this.nodeIds++;
+  for(var i = 0, toAdd = this.getNodeResourcesSize() - node.resources.length; i<toAdd; i++){
+    node.resources.push(0);
+  }
+  this.nodes.set(node.id,node);
+  return node;
+}
+
+/**
+ * Add an edge to the graph
+ * @param {Number|String} id of start node
+ * @param {Number|String} id of end node
+ */
+Graph.prototype.addEdge = function(startId,endId,resources){
+  var s = this.nodes.get(startId);
+  var t = this.nodes.get(endId);
+  var edge = new Graph.Edge(s,t,this.edgeIds++);
+  edge.resources=resources;
+  edge.start.outEdges.set(edge.id,edge);
+  edge.end.inEdges.set(edge.id,edge);
+  this.edges.set(edge.id,edge);
+  return edge;
+}
+
+Graph.prototype.addEdgeDirectly = function(edge){
+  edge.id = this.edgeIds++;
+  edge.start.outEdges.set(edge.id,edge);
+  edge.end.inEdges.set(edge.id,edge);
+  this.edges.set(edge.id,edge);
+  var max = this.getEdgeResourcesSize();
+  while(edge.resources.length<max) edge.resources.push(0);
+  return edge;
+}
+
+Graph.prototype.removeNode = function(id){
+  var that=this;
+  var node = this.nodes.get(id);
+  node.outEdges.forEach(function(key,value){
+      that.removeEdge(key);
+  });
+  node.inEdges.forEach(function(key,value){
+      that.removeEdge(key);
+  });
+  this.nodes.remove(id);
+  return node;
+}
+
+Graph.prototype.removeEdge = function(id){
+    return this.edges.remove(id);
+}
+
+Graph.prototype.getNodes = function(){
+  return this.nodes.values();
+}
+
+Graph.prototype.getEdges = function(){
+  return this.edges.values();
+}
+
+/**
+ * We allow arbitrary size of resources for each node.
+ */
+Graph.prototype.getNodeResourcesSize = function(){
+  var max=0;
+  this.nodes.forEach(function(key,node){
+     max = Math.max(max,node.resources.length);
+  });
+  return max;
+}
+
+Graph.prototype.getEdgeResourcesSize = function(){
+  var max=0;
+  this.edges.forEach(function(key,edge){
+     max = Math.max(max,edge.resources.length);
+  });
+  return max;
+}
+
+Graph.prototype.replace = function(oldGraph){
+  this.nodeIds = oldGraph.nodeIds;
+  this.edgeIds = oldGraph.edgeIds;
+  this.nodes = oldGraph.nodes;
+  this.edges = oldGraph.edges;
+}
+
+Graph.prototype.getState = function(){
+  var savedState = { nodes : {}, edges : {} };
+  this.nodes.forEach(function(key,node){
+     savedState.nodes[key] = JSON.stringify(node.state);
+  });
+  this.edges.forEach(function(key,edge){
+     savedState.edges[key] = JSON.stringify(edge.state);
+  });
+  return savedState;
+}
+
+Graph.prototype.setState = function(savedState){
+  this.nodes.forEach(function(key,node){
+     node.state = JSON.parse(savedState.nodes[key]);
+  });
+  this.edges.forEach(function(key,edge){
+     edge.state = JSON.parse(savedState.edges[key]);
+  });
+}
+
+/////////////////
+//STATICS
+
+/**
+ * Style node or edge resources
+ * @static
+ */
+Graph.styleResources = function(resources,left,right,f){
+  var f = f || function(d){return d};
+  var str = resources.map(f).join(",");
+  if(resources.length>1) str = left + str + right;
+  return str;
+}
+
+/**
+ * Graph serializer static method
+ * Serialize a graph with all resources to string, used when downloading a graph.
+ * @static
+ * @param {Graph} [graph] - Graph object. If not given the current Graph.instance is used
+ * @return {String} text - sequentialized Graph
+ */
+Graph.stringify = function(graph){
+  var graph = graph || Graph.instance;
+  var lines = []; //text.split("\n");
+
+  lines.push("% Graph saved at "+new Date());
+
+  graph.nodes.forEach(function(key,node){
+      var line = "n " + node.x + " " + node.y;
+      if(node.resources.length>0) line +=" "+node.resources.join(" ");
+      lines.push(line);
+  });
+  graph.edges.forEach(function(key,edge){
+      var line = "e " + edge.start.id + " " + edge.end.id;
+      if(edge.resources.length>0) line +=" "+edge.resources.join(" ");
+      lines.push(line);
+  });
+
+  var text = lines.join("\n");
+  return text;
+}
+
+/**
+ * Graph parser static factory method
+ * constructs a Graph object from a textuatl representation of the graph.
+ * @static
+ * @param {String} text - sequentialized Graph
+ * @return {Graph} - parsed Graph object
+ */
+Graph.parse = function(text){
+  var lines = text.split("\n");
+
+  var graph = new Graph();
+
+  function parseResources(s){
+      var resources = [];
+      for(var i=3; i<s.length; i++){
+          resources.push(+s[i]);
+      }
+      return resources;
+  }
+
+  // Nach Zeilen aufteilen
+  for (var line in lines) {
+      var s = lines[line].split(" ");
+      // Nach Parametern aufteilen
+      if (s[0] == "%") { //comment
+          continue;
+      }
+      //x y r1 r2 ...
+      if (s[0] == "n") {
+        graph.addNode(s[1],s[2],parseResources(s));
+      }
+      //s t r1 r2 ... 
+      if (s[0] == "e") {
+        graph.addEdge(s[1],s[2],parseResources(s));
+      };
+  }
+
+  if(graph.nodeIds==0 && graph.edgeIds==0){
+    throw "parse error";
+  }
+
+  return graph;
+}
+
+/**
+ * Singleton to have just one Graph instance per app.
+ */
+Graph.instance = null;
+
+/**
+ * Add callback functions to be executed after a graph was loaded asynchronically, e.g. to initialize the application
+ */
+Graph.addChangeListener = function(callbackFp){
+  Graph.onLoadedCbFP.push(callbackFp);
+}
+Graph.onLoadedCbFP = [];
+
+/**
+ * Replace the current graph singleton instance and call the defined callback functions.
+ * This function is both called asyncronically from within ajax loading of graphs from servers and from local file uploads.
+ */
+Graph.setInstance = function(error,text,filename,exceptionFp){
+    if(error != null){
+      exceptionFp ? exceptionFp(error,text,filename) : console.log(error,text,filename);
+      return;
+    };
+    var noErrors=false;
+    try{
+      Graph.instance = Graph.parse(text);
+      noErrors=true;
+    }catch(ex){
+      if(exceptionFp) exceptionFp(ex,text,filename);
+      else console.log(ex,text,filename);
+    }
+    if(noErrors) Graph.onLoadedCbFP.forEach(function(fp){fp()});
+}
+
+/**
+ * Ajax graph file loading from a server
+ * using d3.text instead of raw ajax calls
+ * calls setInstance async.
+ */
+Graph.loadInstance = function(filename,exceptionFp){
+  d3.text(filename, function(error,text){
+    Graph.setInstance(error,text,filename,exceptionFp)
+  });
+}
+
+/**
+ * Upload graph file from a local computer
+ * using HTML5 FileReader feature
+ * calls setInstance async.
+ */
+Graph.handleFileSelect = function(evt,exceptionFp) {
+    var files = evt.target.files; // FileList object
+
+    // Loop through the FileList and render image files as thumbnails.
+    for (var i = 0, f; f = files[i]; i++) {
+
+      // Only process image files.
+      if (!f.type.match('text/plain')) {
+        exceptionFp("wrong mimetype",f.type);
+        continue;
+      }
+
+      var reader = new FileReader();
+
+      // Closure to capture the file information.
+      reader.onload = (function(theFile) {
+        return function(e) {
+          var error = e.target.error;
+          var text = e.target.result;
+          var filename = theFile.name;
+          Graph.setInstance(error,text,filename,exceptionFp)
+        };
+      })(f);
+
+      // Read in the image file as a data URL.
+      reader.readAsText (f);
+    }
+}
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/implementation-doc/library-d3-svg_js_GraphDrawer.js.html b/implementation-doc/library-d3-svg_js_GraphDrawer.js.html new file mode 100644 index 0000000..5e78cb1 --- /dev/null +++ b/implementation-doc/library-d3-svg_js_GraphDrawer.js.html @@ -0,0 +1,476 @@ + + + + + JSDoc: Source: library-d3-svg/js/GraphDrawer.js + + + + + + + + + + +
+ +

Source: library-d3-svg/js/GraphDrawer.js

+ + + + + + +
+
+
/**
+ * Die Farben, die im Projekt genutzt werden.
+ * Aus dem TUM Styleguide.
+ * @type Object 
+ */
+var const_Colors = {
+    NodeFilling:            "#98C6EA",  // Pantone 283, 100%
+    NodeBorder:             "#0065BD",  // Pantone 300, 100%, "TUM-Blau"
+    NodeBorderHighlight:    "#C4071B",  // Helles Rot 100% aus TUM Styleguide
+    NodeFillingHighlight:   "#73B78D",  // Dunkelgrün 55 % aus TUM Styleguide
+    NodeFillingLight:       "#00c532",  // Dunkelgrün 55 % aus TUM Styleguide
+    NodeFillingQuestion:    "#C4071B",  // Helles Rot 100% aus TUM Styleguide
+    EdgeHighlight1:         "#C4071B",  // Helles Rot 100% aus TUM Styleguide
+    EdgeHighlight2:         "#73B78D",  // Dunkelgrün 55 % aus TUM Styleguide
+    EdgeHighlight3:         "#73B78D",  // Dunkelgrün 55 % aus TUM Styleguide
+    EdgeHighlight4:         "#007C30",  // Dunkelgrün 100 % aus TUM Styleguide
+    RedText:                "#C4071B",  // Helles Rot 100% aus TUM Styleguide
+    GreenText:              "#007C30",   // Dunkelgrün 100 % aus TUM Styleguide
+    PQColor : "#FFFF70", // Helles Gelb
+    StartNodeColor : "#33CC33", // Dunklgrün
+    CurrentNodeColor : "#C4071B", // Helles Rot
+    FinishedNodeColor : "#73B78D", // Wie EdgeHighlight2
+    ShortestPathColor : "#73B78D", // Wie EdgeHighlight2
+    UnusedEdgeColor : "#0065BD", // Wie NodeBorder
+    NormalEdgeColor : "#000000" // Schwarz
+};
+
+/**
+ * Standardgröße eines Knotens
+ * @type Number
+ */
+var global_KnotenRadius = 15;
+
+/**
+ * Standardaussehen einer Kante.
+ * @type Object
+ */
+var global_Edgelayout = {
+    'arrowAngle' : Math.PI/8,	         // Winkel des Pfeilkopfs relativ zum Pfeilkörper
+    'arrowHeadLength' : 15,             // Länge des Pfeilkopfs
+    'lineColor' : "black",		         // Farbe des Pfeils
+    'lineWidth' : 2,		             // Dicke des Pfeils
+    'font'	: 'Arial',		             // Schrifart 
+    'fontSize' : 14,		             // Schriftgrösse in Pixeln
+    'isHighlighted': false,             // Ob die Kante eine besondere Markierung haben soll
+    'progressArrow': false,             // Zusätzlicher Animationspfeil 
+    'progressArrowPosition': 0.0,       // Position des Animationspfeils
+    'progressArrowSource': null,        // Animationspfeil Source Knoten
+    'progressArrowTarget': null         // Animationspfeil Target Knoten
+};
+                        
+/**
+ * Standardaussehen eines Knotens.
+ * @type Object
+ */
+var global_NodeLayout = {
+    'fillStyle' : const_Colors.NodeFilling,    // Farbe der Füllung
+    'nodeRadius' : 15,                         // Radius der Kreises
+    'borderColor' : const_Colors.NodeBorder,   // Farbe des Rands (ohne Markierung)
+    'borderWidth' : 2,                         // Breite des Rands
+    'fontColor' : 'black',                     // Farbe der Schrift
+    'font' : 'bold',                           // Schriftart
+    'fontSize' : 14                            // Schriftgrösse in Pixeln
+};
+
+/**
+ * Helper function to return a string representaiton of SVG's translate tranform
+ */
+function translate(x,y){
+    return "translate("+x+","+y+")";
+}
+
+/**
+ * Global map where we save the GraphDrawer instances. Used when saving svg to disc.
+ */
+GraphAlgos = d3.map();
+
+/**
+ * @classdesc
+ * The base class of a Network visualization of a graph. Based on D3 and SVG.
+ * Graph Editors and Graph Algorithms should inherit from this class.
+ * @constructor
+ */
+GraphDrawer = function(svgOrigin,extraMargin,transTime){
+
+    /////////////////
+    //PRIVATE
+    var id = svgOrigin.attr("id");
+    GraphAlgos.set(id,this);
+
+    var transTime = (transTime!=null) ? transTime : 250;
+
+    var extraMargin = extraMargin || {};
+
+    var xRange = +svgOrigin.attr("width") || 400;
+        yRange = +svgOrigin.attr("height") || 300;
+    var wS = global_NodeLayout['borderWidth'];
+    
+    var margin = {
+        top: global_KnotenRadius+wS+ (extraMargin.top || 10),
+        right: global_KnotenRadius+wS,
+        bottom: global_KnotenRadius+wS,
+        left: global_KnotenRadius+wS +(extraMargin.left || 0)
+    }
+
+    var width = xRange - margin.left - margin.right;
+    var height = yRange - margin.top - margin.bottom;
+
+    this.height = height;
+    this.width = width;
+
+    this.margin = margin;
+
+    var radius = global_KnotenRadius;//20;
+
+    svgOrigin
+        .attr({version: '1.1' , xmlns:"http://www.w3.org/2000/svg"})
+        .attr("width", width + margin.left + margin.right)
+        .attr("height", height + margin.top + margin.bottom)
+
+    var svg = svgOrigin.append("g")
+        .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+
+    this.svg=svg;
+
+    var svg_links=svg.append("g").attr("id", "edges");
+    var svg_nodes=svg.append("g").attr("id", "nodes");
+
+    this.x = d3.scale.linear()
+        .range([margin.left, width-margin.right])
+        .domain([0,xRange]);
+
+    this.y = d3.scale.linear()
+        .range([height-margin.top, margin.bottom])
+        .domain([0,yRange]);
+
+    var transform = function(d){
+        return translate(this.x(this.nodeX(d)),this.y(this.nodeY(d)));
+    }; transform = transform.bind(this);
+
+    //fit the graph extend in a smaller window. needed for algorithm tab 
+    //since there the network graph is only half as wide as in the graph editor tab.
+    NOSQUEEZE=false;
+    this.squeeze = function(){
+        if(NOSQUEEZE) return; //define flag for debug
+        var nodes;
+
+        if(Graph.instance && (nodes = Graph.instance.getNodes())){
+            this.x.domain(d3.extent(nodes, function(d) { return d.x; }));
+            this.y.domain(d3.extent(nodes, function(d) { return d.y; }));
+        }
+    }
+
+    var xfun = function(d){
+        return this.x(this.nodeX(Graph.instance.nodes.get(d.id) || d));
+    }; xfun = xfun.bind(this);
+
+
+    var yfun = function(d){
+        return this.y(this.nodeY(Graph.instance.nodes.get(d.id) || d));
+    }; yfun = yfun.bind(this);
+
+    function lineAttribs(d){
+        var attr = { x1:xfun(d.start), y1:yfun(d.start), x2:xfun(d.end), y2:yfun(d.end)};
+        if(transTime) d3.select(this).transition().duration(transTime).attr(attr)
+        else d3.select(this).attr(attr);
+    };
+
+    function textAttribs(d){
+        var attr = { x : (xfun(d.start)+xfun(d.end))*0.5 , y : ( yfun(d.start)+yfun(d.end))*.5};
+        if(transTime) d3.select(this).transition().duration(transTime).attr(attr)
+        else d3.select(this).attr(attr);
+    };
+
+
+
+    /////////////////
+    //PRIVILEDGED
+
+    this.clear = function(){
+        svg_nodes.selectAll("g").remove();
+        svg_links.selectAll("g").remove();
+    };
+
+    this.type="GraphDrawer";
+    this.graph = Graph.instance;
+    this.svgOrigin = svgOrigin;
+
+    var that = this;
+
+    this.screenPosToNodePos = function(pos){
+        return {x: that.x.invert(pos[0]-margin.left), y: that.y.invert(pos[1]-margin.top)};
+    };
+
+    this.screenPosToTransform = function(pos){
+        return "translate(" + (pos[0]-margin.left) + "," + (pos[1]-margin.top) + ")";
+    }
+
+    /**
+     * D3's Data Join of node data with their visualization (circles)
+     */
+    this.updateNodes = function(){
+
+        // DATA JOIN
+        // Join new data with old elements, if any.
+          var selection = svg_nodes.selectAll(".node")
+            .data(Graph.instance.getNodes(),function(d){return d.id});
+
+
+        // UPDATE
+        // Update old elements as needed.
+
+        // ENTER
+        // Create new elements as needed.
+          var enterSelection = selection
+            .enter().append("g")
+            .attr("class","node")
+            .call(this.onNodesEntered);//Foo.prototype.setText.bind(bar))
+
+            enterSelection.append("circle")
+                .attr("r", radius)
+                .style("fill",global_NodeLayout['fillStyle'])
+                .style("stroke-width",global_NodeLayout['borderWidth'])
+                .style("stroke",global_NodeLayout['borderColor'])
+
+            enterSelection.append("text")
+                .attr("class","label unselectable")
+                .attr("dy", ".35em")           // set offset y position
+                .attr("text-anchor", "middle")
+
+            enterSelection.append("text")
+                .attr("class","resource unselectable")
+                .attr("dy",-global_KnotenRadius+"px")           // set offset y position
+                .attr("text-anchor", "middle")
+
+
+        // ENTER + UPDATE
+        // Appending to the enter selection expands the update selection to include
+        // entering elements; so, operations on the update selection after appending to
+        // the enter selection will apply to both entering and updating nodes.
+            if(transTime){
+            selection
+                .transition().duration(transTime)
+                .attr("transform",transform)
+                .call(this.onNodesUpdated);
+            }else{
+            selection
+                .attr("transform",transform)
+                .call(this.onNodesUpdated);
+            }
+
+            selection.selectAll("text.label")
+                 .text(this.nodeLabel);
+
+            var res = selection.selectAll("text.resource")
+            
+            if(this.nodeHtml){
+              res.html(this.nodeHtml);
+            }else{
+              res.text(this.nodeText);
+            }
+            
+
+
+        // EXIT
+        // Remove old elements as needed.
+              selection.exit().remove();
+    
+    } //end updateNodes()
+
+
+    /**
+     * D3's Data Join of edge data with their visualization (lines)
+     */
+    this.updateEdges = function(){
+
+        var selection = svg_links.selectAll(".edge")
+            .data(Graph.instance.getEdges(),function(d){
+                return d.id;
+             });
+
+    //ENTER
+
+        var enterSelection = selection
+            .enter()
+            .append("g")
+            .attr("class","edge")
+            .call(this.onEdgesEntered);
+        
+
+        enterSelection.append("line")
+            .attr("class","arrow")
+            .style("marker-end", "url(#arrowhead2)")
+            .style("stroke","black")
+            .style("stroke-width",global_Edgelayout['lineWidth'])
+
+        enterSelection.append("text")
+//             .style("text-anchor", "middle")
+//             .attr("dominant-baseline","middle")
+//             .attr("dy", "-.5em")           // set offset y position
+            .attr("class","resource unselectable edgeLabel")
+   
+
+    var that = this;
+
+
+    //ENTER + UPDATE
+        var selt = selection;//.transition().duration(1000);
+        selt.selectAll("line")
+            .each(lineAttribs)
+//             .style("opacity",1e-6)
+//             .transition()
+//             .duration(750)
+//             .style("opacity",1);
+            
+        var res = selt.selectAll("text.resource");
+
+          if(this.edgeHtml){
+            res.html(this.edgeHtml);
+          }else{
+            res.text(this.edgeText);
+          }
+
+            res
+            .style("text-anchor", function(d){
+                var arrowXProj = that.nodeX(d.start)-that.nodeX(d.end);
+                return (arrowXProj>0) ? "start" : "end";
+            })
+            .attr("dominant-baseline",function(d){
+                var arrowYProj = that.nodeY(d.start)-that.nodeY(d.end);
+                return (arrowYProj>0) ? "text-before-edge" : "text-after-edge";
+            })
+            .each(textAttribs)
+
+
+        selection.call(this.onEdgesUpdated)
+
+    //EXIT
+        var exitSelection = selection.exit()
+        exitSelection.remove();
+
+    }
+
+    //initialize //TODO: is called twice when we init both tabs at the same time
+    if(Graph.instance==null){
+        //calls registered event listeners when loaded;
+        var GRAPH_FILENAME = GRAPH_FILENAME || null;
+        var filename = GRAPH_FILENAME || "graphs-new/"+$("#tg_select_GraphSelector").val()+".txt"; //the selected option 
+       Graph.loadInstance(filename,function(error,text,filename){
+           console.log("error loading graph instance "+error + " from " + filename +" text: "+text);
+       }); 
+    }
+} //end constructor GraphDrawer
+
+/**
+ * The main function which triggers updates to node and edge selections. 
+ */
+GraphDrawer.prototype.update= function(){
+  this.updateNodes();
+  this.updateEdges();
+}
+
+/**
+ * Called when new nodes are entering
+ */
+GraphDrawer.prototype.onNodesEntered = function(selection) {
+//     console.log(selection[0].length + " nodes entered")
+}
+/**
+ * Called when exisitng nodes are updated
+ */
+GraphDrawer.prototype.onNodesUpdated = function(selection) {
+//     console.log(selection[0].length + " nodes updated")
+}
+/**
+ * Called when new edges are entering
+ */
+GraphDrawer.prototype.onEdgesEntered = function(selection) {
+//     console.log(selection[0].length + " edges entered")
+}
+/**
+ * Called when exisitng edges are updated
+ */
+GraphDrawer.prototype.onEdgesUpdated = function(selection) {
+//     console.log(selection[0].length + " edges entered")
+}
+
+/**
+ * Displays in the middle of the edge (typically cost/resource vectors or capacity/flow)
+ */
+GraphDrawer.prototype.edgeText = function(d){
+    return d.toString();
+}
+
+/**
+ * Displays on top of a node (typically constraints or state variables)
+ */
+GraphDrawer.prototype.nodeText = function(d){
+    return d.toString();   
+}
+
+/**
+ * Displays inside of a node (typically its id)
+ */
+GraphDrawer.prototype.nodeLabel = function(d){
+    return d.id;
+}
+
+/**
+ * X Position of a node
+ */
+GraphDrawer.prototype.nodeX = function(d){
+    return d.x;
+};
+/**
+ * Y Position of a node
+ */
+GraphDrawer.prototype.nodeY = function(d){
+    return d.y;
+};
+GraphDrawer.prototype.nodePos = function(d){
+    var obj = {};
+    obj.x = this.x(this.nodeX(d));
+    obj.y = this.y(this.nodeY(d));
+    return obj;
+}
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/implementation-doc/library-d3-svg_js_GraphEditor.js.html b/implementation-doc/library-d3-svg_js_GraphEditor.js.html new file mode 100644 index 0000000..e2104e6 --- /dev/null +++ b/implementation-doc/library-d3-svg_js_GraphEditor.js.html @@ -0,0 +1,327 @@ + + + + + JSDoc: Source: library-d3-svg/js/GraphEditor.js + + + + + + + + + + +
+ +

Source: library-d3-svg/js/GraphEditor.js

+ + + + + + +
+
+
var GraphEditor = function(svgOrigin){
+  GraphDrawer.call(this,svgOrigin,null,0);
+
+  this.type="GraphEditor";
+
+  this.svgOrigin
+    .on("dblclick",dblclick) //for adding new nodes
+    .on("mousemove",mousemove)
+    .on("mousedown",mousedown)
+    .on("contextmenu", function(d){d3.event.stopPropagation();d3.event.preventDefault()});
+
+  this.onNodesEntered = function(selection) {
+    
+    selection
+      .on("mousedown", mousedownNode)
+      .on("mouseup", mouseupNode)
+      .on("contextmenu", contextmenuNode)
+      .on("dblclick",dblclickResource);
+//       .style("cursor","move") //crosshair pointer move
+
+  }
+
+  this.onNodesUpdated = function(selection){
+      selection
+       .style("cursor",function(d){
+        return (dragging && d == selectedNode) ? "move" : "pointer"
+      })
+      .selectAll("circle")
+       .style("stroke", function(d){
+        if(d==selectedNode){
+          return const_Colors.NodeBorderHighlight;
+        }else{
+          return global_NodeLayout['borderColor'];
+        }
+      })
+
+  }
+
+  this.onEdgesEntered = function(selection) {
+//     console.log("onEdgesEntered in GraphEditor");
+    
+    selection
+//       .on("dblclick",dblclickEdge)
+      .on("contextmenu", contextmenuEdge)
+      .style("cursor","pointer") //crosshair pointer move
+    
+    var all =selection.on("dblclick",dblclickResource);
+
+
+//     GraphDrawer.prototype.onEdgesEntered.call(this,selection);
+  }
+
+  this.onEdgesUpdated = function(selection) {
+//     console.log("onEdgesEntered in GraphEditor");
+    
+    selection
+      .style("cursor",function(d){
+        return (d == unfinishedEdge) ? "crosshair" : "pointer";
+      }) //crosshair pointer move
+
+//     GraphDrawer.prototype.onEdgesEntered.call(this,selection);
+  }
+
+    var that=this;
+
+    /**
+     * Zeigt an, ob wir im Moment die Maus bei gedrücktem Mauszeiger verschieben
+     * (Drag and Drop)
+     * @type Boolean
+     */
+    var dragging = false;
+
+    /**
+     * Zeigt an, ob wir beim letzten Event noch verschoben haben
+     * (dann wir der aktuell ausgewählte Knoten abgewählt)
+     * @type Boolean
+     */
+    var hasDragged = false;
+
+    /**
+     * Der aktuell ausgewählte Knoten
+     */
+    var selectedNode = null;
+
+    /**
+      * line that is beeing drawn
+      */
+    var unfinishedEdge = null;
+
+
+    var deselectNode = function(){
+      if(selectedNode != null){
+//         selectedNode.style("stroke","black");
+        selectedNode = null;
+      }
+      unfinishedEdge = null;
+          that.svgOrigin.style("cursor","default");
+
+      blurResourceEditor();
+      that.update();
+    }
+
+    var selectNode = function(selection){
+      selectedNode = selection;
+//       selectedNode.style("stroke","red");
+    }
+
+    /**
+     * End of mouseclick on a node
+     * @method
+     */
+    function mouseupNode(){
+      dragging = false;
+      if(hasDragged){
+        deselectNode();
+      }else if(selectedNode){
+        var endNode = new Graph.Node(selectedNode.x, selectedNode.y, "invisible");
+        unfinishedEdge = new Graph.Edge(selectedNode,endNode,"unfinished");
+        Graph.instance.addEdgeDirectly(unfinishedEdge);
+        svgOrigin.style("cursor","crosshair") //crosshair
+      }
+      hasDragged = false;
+      d3.event.stopPropagation(); //we dont want svg to receive the event
+      that.updateNodes();
+    }
+
+    /**
+      * moving a mouse on the svgOrigin
+      */
+    function mousemove(){
+      if(selectedNode != null){
+          var pos = d3.mouse(this);
+          var xy = that.screenPosToNodePos(pos);
+          //moving a node
+          if(dragging){
+//             d3.select(this).style("cursor","move");
+            selectedNode.x = xy.x; //.datum()
+            selectedNode.y = xy.y;
+            hasDragged = true;
+            that.update();
+          }
+          //drawing an edge
+          else{
+            unfinishedEdge.end.x = xy.x;
+            unfinishedEdge.end.y = xy.y;
+            that.updateEdges();
+          }
+
+       }
+     }
+
+function dblclick(){
+  d3.event.preventDefault();d3.event.stopPropagation();
+  var pos = d3.mouse(this);
+  addNode(pos);
+  
+}
+
+//Es wird entweder die Auswahl aufgehoben, ein Knoten ausgewählt oder eine Kante zwischen vorhandenen Knoten erstellt.
+function mousedownNode(d,id){
+  if(selectedNode == d){// Falls wir wieder auf den selben Knoten geklickt haben, hebe Auswahl auf.
+      if(unfinishedEdge) Graph.instance.removeEdge(unfinishedEdge.id);
+      deselectNode();
+  }else if(selectedNode == null) { // Falls wir nichts ausgewählt hatten, wähle den Knoten aus
+      dragging = true;
+      selectNode(d);
+  }else {// Füge Kante hinzu
+//       graph.addEdge(selectedNode.id,d.id);
+      unfinishedEdge.end=d; //throw away temporary end node;
+      deselectNode();
+      that.updateEdges();
+  }
+
+  that.update();
+
+  blurResourceEditor();
+
+  d3.event.stopPropagation(); //we dont want svg to receive the event
+}
+ //oder ein neuer erstellt (wenn grade kante gezeichnet wird),
+// Wir haben nicht auf einem Knoten gestoppt 
+// -> Falls etwas ausgewählt war, erstelle Knoten und zeichne Kante
+function mousedown(a,b,c){
+  if(selectedNode){ //unfinishedEdge starts in selectedNode
+    var pos = d3.mouse(this);
+//     var end = addNode(pos);
+//     this.graph.addEdge(selectedNode,end);
+//     this.updateEdges();
+    Graph.instance.addNodeDirectly(unfinishedEdge.end);
+    that.updateNodes();
+    deselectNode();
+  }
+
+  blurResourceEditor();
+}
+
+function blurResourceEditor(){
+  updateResources([]);
+//   if(!myDiv) return;
+//     myDiv
+// //     .style("opacity",1e-6)
+// //     .style("left", "0px")
+// //     .style("top", "0px");
+}
+
+var myDiv = d3.select("body");//.append("div")
+
+function updateResources(data){
+      var selection = myDiv.selectAll("input.resourceEditor")
+    .data(data);
+
+  selection.enter().append("input")
+      .attr("type","number")
+      .attr("class", "tooltip resourceEditor")
+//       .style("opacity", 1)
+
+  selection
+  .attr("value",function(a,b,c){ 
+    return +a;
+  })
+  .on("input", function(a,b,c) {
+     data[b]=+this.value;
+     that.update()
+  })
+  .style("left", function(a,b,c){
+    return (d3.event.pageX - 30+40*b) + "px"
+  })
+  .style("top", function(a,b,c){return (d3.event.pageY)+ "px"})
+
+  selection.exit().remove();  
+}
+
+//<input type="number" min="0" max="360" step="5" value="0" id="nValue">
+function dblclickResource(d,i,all)
+{
+  d3.event.stopPropagation();d3.event.preventDefault();
+  updateResources(d.resources);  
+}
+
+function contextmenuNode(d){
+  deselectNode();
+  d3.event.stopPropagation();d3.event.preventDefault();
+  Graph.instance.removeNode(d.id);
+  that.update();
+}
+
+function contextmenuEdge(d){
+  deselectNode();
+  d3.event.stopPropagation();d3.event.preventDefault();
+  Graph.instance.removeEdge(d.id);
+  that.updateEdges();
+}
+
+function addNode(pos){
+  var xy = that.screenPosToNodePos(pos);
+  Graph.instance.addNode(xy.x, xy.y);
+  that.update();
+//   return point;
+}
+}
+
+//inheritance
+GraphEditor.prototype = Object.create(GraphDrawer.prototype);
+GraphEditor.prototype.constructor = GraphEditor;
+
+// function SpaceShip(scene, x, y) {
+//   Actor.call(this, scene, x, y);
+//   this.points = 0;
+// }
+// Calling the Actor constructor first ensures that all the instance properties created by Actor are added to the new object. After that, SpaceShip can define its own instance properties such as the ship’s current points count.
+// In order for SpaceShip to be a proper subclass of Actor, its prototype must inherit from Actor.prototype. The best way to do the extension is with ES5’s Object.create:
+// SpaceShip.prototype = Object.create(Actor.prototype);
+
+// Things to Remember
+// - Call the superclass constructor explicitly from subclass construc- tors, passing this as the explicit receiver.
+// - Use Object.create to construct the subclass prototype object to avoid calling the superclass constructor.
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/implementation-doc/library-d3-svg_js_GraphEditorTab.js.html b/implementation-doc/library-d3-svg_js_GraphEditorTab.js.html new file mode 100644 index 0000000..0ac2f76 --- /dev/null +++ b/implementation-doc/library-d3-svg_js_GraphEditorTab.js.html @@ -0,0 +1,136 @@ + + + + + JSDoc: Source: library-d3-svg/js/GraphEditorTab.js + + + + + + + + + + +
+ +

Source: library-d3-svg/js/GraphEditorTab.js

+ + + + + + +
+
+
/**
+ * A graph editor in a Tab
+ * @author Adrian Haarbach
+ * @augments Tab
+ * @class
+ */
+function GraphEditorTab(algo,p_tab) {
+    Tab.call(this, algo, p_tab);
+
+    var that = this;
+    
+    /**
+     * Wires up the events on button clicks or selection changes and listens to a Graph change event
+     * @method
+     */
+    this.init = function() {
+        $("#tg_button_gotoAlgorithmTab").click(function() {
+            $("#tabs").tabs("option","active",2);
+        });
+        $("#tg_select_GraphSelector").on("change.GraphDrawer",that.setGraphHandler);     // Beispielgraph auswählen
+        
+        //add function to be called after a new graph has been loaded.
+        Graph.addChangeListener(function(){
+            algo.clear();
+            algo.update();
+        });
+
+        $('#fileDownloader').on('click',function(foo){
+            var ahref = $(this);
+            var text = Graph.stringify();
+            text = "data:text/plain,"+encodeURIComponent(text);
+            ahref.prop("href",text);
+        });
+
+        $('#ta_div_parseError').dialog({
+            autoOpen: false,
+            resizable: false,
+    //      modal: true,
+            buttons: {
+                "Ok": function() {
+                    $(this).dialog( "close" );
+                } 
+            }
+        }); 
+
+        $('#fileUploader').on('change',function(ev){
+            Graph.handleFileSelect(ev,function(errCode,errDescription,filename){
+                    $('#ta_div_parseError').dialog("open");
+                    $('#ta_div_parseErrorText').text(errCode);
+                    $('#ta_div_parseErrorFilename').text(filename);
+                    $('#ta_div_parseErrorDescription').text(errDescription);
+            })
+        });
+        
+        //inheritance
+        Tab.prototype.init.call(this);
+    };
+    
+    /**
+     * When Tab comes into view we update the view
+     * @method
+     */
+    this.activate = function() {
+       if(Graph.instance) algo.update();
+       Tab.prototype.activate.call(this);
+
+    };
+    
+    /**
+     * A different example graph was selected. Triggers the loader
+     * @method
+     */
+    this.setGraphHandler = function() {
+        var selection = $("#tg_select_GraphSelector>option:selected").val();
+        var filename = selection + ".txt";
+        //console.log(filename);
+
+        //load graph as singleton
+        //calls registered event listeners when loaded
+        Graph.loadInstance("graphs-new/"+filename);
+    };
+}
+
+//Prototypal inheritance
+GraphEditorTab.prototype = Object.create(Tab.prototype);
+GraphEditorTab.prototype.constructor = Tab;
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/implementation-doc/library-d3-svg_js_Logger.js.html b/implementation-doc/library-d3-svg_js_Logger.js.html new file mode 100644 index 0000000..8772514 --- /dev/null +++ b/implementation-doc/library-d3-svg_js_Logger.js.html @@ -0,0 +1,136 @@ + + + + + JSDoc: Source: library-d3-svg/js/Logger.js + + + + + + + + + + +
+ +

Source: library-d3-svg/js/Logger.js

+ + + + + + +
+
+
/**
+ * Writes to the Log tab in the algorithm
+ * @author Adrian Haarbach
+ * @class
+ * @param {Object} parentDiv - a d3 selector
+ */
+Logger = function(parentDiv,lastEntryDiv){
+  parentDiv.style("text-align","left");
+  var outerList = parentDiv.append("ol").attr("class","level1");
+  this.parentDiv = parentDiv;
+  this.lastEntryDiv = lastEntryDiv;
+
+  this.reset();
+}//end Logger
+
+//static
+Logger.listTypes=["ol","ol","ul","ul","ul"];
+
+
+Logger.prototype.addLogEntry = function(text,parentId){
+  var newId = this.state.idCounter++;
+  var logEntry = {text:text, id:newId, children:[]};
+  //this.map.set(logEntry.id,logEntry);
+  this.state.map[logEntry.id]=logEntry;
+  if(parentId !== null){
+    var innerNode = this.state.map[parentId];//this.map.get(parentId);
+    innerNode.children.push(logEntry.id);
+  }
+  return logEntry;
+}
+
+Logger.prototype.log = function(val){
+  var logEntry = this.addLogEntry(val,"root");
+  this.state.id2=logEntry.id;
+  this.update();
+}
+
+Logger.prototype.log2 = function(val){
+  var logEntry = this.addLogEntry(val,this.state.id2);
+  this.state.id3=logEntry.id;
+  this.update();
+}
+
+Logger.prototype.log3 = function(val){
+  var logEntry = this.addLogEntry(val,this.state.id3);
+  this.update();
+}
+
+Logger.prototype.reset = function(){
+  this.state = {
+    idCounter : 0,
+    id2 : -1,
+    id3 : -1,
+    map : {"root" : {children:[]}}
+  }
+//   this.map = d3.map();
+//   this.map.set("root",{children:[]});
+}
+
+
+Logger.prototype.updateRecursive = function(arr,selection,depth){
+  if(arr && arr.length > 0){
+    var childContainer = selection.append(Logger.listTypes[depth]);
+    arr.forEach(function(childItemId){
+      var childItem = this.state.map[childItemId];//this.map.get(childItemId);
+      var listItem = childContainer.append("li");
+      listItem.html(childItem.text);
+      this.lastEntryDiv.html(childItem.text);
+      this.updateRecursive(childItem.children,listItem,depth+1);
+    },this);
+  }
+}
+
+Logger.prototype.update = function(){
+  this.parentDiv.selectAll("ol").remove();
+  this.lastEntryDiv.html("");
+  this.updateRecursive(this.state.map["root"].children,this.parentDiv,0);
+}
+
+Logger.prototype.setState = function(state){
+  this.state = JSON.parse(state);
+}
+
+Logger.prototype.getState = function(){
+  return JSON.stringify(this.state);
+}
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/implementation-doc/library-d3-svg_js_Tab.js.html b/implementation-doc/library-d3-svg_js_Tab.js.html new file mode 100644 index 0000000..893a832 --- /dev/null +++ b/implementation-doc/library-d3-svg_js_Tab.js.html @@ -0,0 +1,311 @@ + + + + + JSDoc: Source: library-d3-svg/js/Tab.js + + + + + + + + + + +
+ +

Source: library-d3-svg/js/Tab.js

+ + + + + + +
+
+
/**
+ * A Tab in the view. Wires together the legend and calls algo's activation functions.
+ * @author Adrian Haarbach
+ * @class
+ * @param {GraphDrawer} algo - Instance of an algorithm. Must have interface methods : init, activate, deactivate
+ * @param {Object} p_tab - Jquery tab elector
+ */
+function Tab(algo,p_tab) {
+
+    var that = this;
+    this.algo=algo;
+
+    /**
+     * jQuery Objekt des aktuellen Tabs
+     * @type Object
+     */
+    this.tab = p_tab;
+
+    this.initialized = false;
+    
+    /**
+     * Initialisiert das Zeichenfeld
+     * @method
+     */
+    this._init = function() {
+        legendeMax = this.tab.find(".Legende");
+        legendeMin = this.tab.find(".LegendeMinimized");
+        legendeMaxButton = legendeMax.find(".LegendeMin");
+        legendeMinButton = legendeMin.find(".LegendeMin");
+        tabIntroDialog = this.tab.find(".tabIntroDialog");
+        tabChangeWarningDialog = this.tab.find(".tabChangeWarningDialog");
+        statusWindow = this.tab.find(".statusWindow");
+        this.statusBackup = statusWindow.html();
+        this.animateLegende();
+//         this.svgOrigin.attr('user-select','none').attr('unselectable','on').on("selectstart.CanvasDrawer",false);
+//         this.drawIntervalID = setInterval(function() { algo.drawCanvas(); }, 20);
+//         this.needRedraw = true;
+        this.openDialogs();
+//         this.addRefreshToTabbar();
+
+        //         this.registerEventHandlers();
+//         this.needRedraw = true;
+        this.minimizeLegend();
+        algo.init && algo.init();
+        this.initialized=true;
+    };
+    
+    /**
+     * when tab is openend
+     * @method
+     */
+    this._activate = function() {
+        if(!this.initialized) this.init();
+        algo.activate && algo.activate();
+    };
+    
+    /**
+     * when tab is closed
+     * @method
+     */
+    this._deactivate = function() {
+        algo.deactivate && algo.deactivate();
+    };
+
+    /**
+     * HTML des Tabs vor dem Öffnen des Tabs
+     * @type String
+     */
+    this.statusBackup = null;
+    /**
+     * Zeigt an, ob der Tab z.Zt. aktiv ist (ungenutzt)
+     * @type Boolean
+     */
+    this.active = false;
+    
+    /**
+     * jQuery Objekt der maximierten Legende
+     * @type Object
+     */
+    var legendeMax;
+    /**
+     * jQuery Objekt der minimierten Legende
+     * @type Object
+     */
+    var legendeMin;
+    /**
+     * jQuery Objekt des "Maximieren" Buttons de Legende im aktuellen Tab
+     * @type Object
+     */
+    var legendeMaxButton;
+    /**
+     * jQuery Objekt des "Minimieren" Buttons de Legende im aktuellen Tab
+     * @type Object
+     */
+    var legendeMinButton;
+    /**
+     * jQuery Objekt des Dialogs, der zu Beginn des Tabs gezeigt wird.
+     * @type Object
+     */
+    var tabIntroDialog;
+    /**
+     * jQuery Objekt des Dialogs, der zu Beginn des Tabs gezeigt wird.
+     * @type Object
+     */
+    var tabChangeWarningDialog;
+    /**
+     * jQuery Objekt des statusFensters des Tabs
+     * @type Object
+     */
+    var statusWindow;
+    
+    
+    /**
+     * Entfernt Intervalle und Event Handler für die den Canvas Drawer
+     * @method
+     */
+//     this.destroyCanvasDrawer = function() {
+//         legendeMaxButton.off("click.CanvasDrawer");
+//         legendeMinButton.off("click.CanvasDrawer");
+// //         this.svgOrigin.selectAll("*").remove();
+// //         this.canvas.off("selectstart.CanvasDrawer");
+// //         window.clearInterval(this.drawIntervalID);
+//         tabIntroDialog.dialog("destroy");
+// //         if($("body").data("graph")) {
+// // //             $("body").data("graph").restoreLayout();
+// //         }
+//         this.tab.find(".statusWindow").html(this.statusBackup);
+//         this.removeRefreshFromTabbar();
+//     };
+
+    /**
+     * Minimiert die Legende und positioniert sie korrekt.
+     * @method
+     */
+    this.minimizeLegend = function() {
+        legendeMax.hide();
+        legendeMin.show();
+    };
+
+    /**
+     * Maximiert die Legende und positioniert sie korrekt.
+     * @method
+     */
+    this.maximizeLegend = function() {
+        legendeMax.show();
+        legendeMin.hide();
+    };
+    
+    /**
+     * Öffnet die Dialoge, die zu dem Tab gehören: Eingangsdialog und mglw. 
+     * Abfrage, ob man den Tab wirklich verlassen möchte.
+     * @method
+     */
+    this.openDialogs = function() {
+        var currentTab = this.tab;      // Closure
+        var minW = 150;
+        if(this.tab.attr("id") == "tab_tf2") {
+            minW = 570;
+        }
+        $(function() {
+            tabIntroDialog.dialog({
+                dialogClass: "shadow",
+                resizable: false,
+                draggable: false,
+                minWidth: minW,
+                position: { my: "center center", at: "center center", of: currentTab},
+                modal: false,
+                autoOpen: false,
+                beforeClose: function(event, ui) {
+                    tabIntroDialog.effect('transfer', {
+                        to: statusWindow
+                    }, 500, null);
+                    return true;
+                },
+                buttons: {
+                    Ok: function() {$(this).dialog( "close" );}
+                }
+            });
+        });
+
+        if(!tabIntroDialog.data("wasOpen")) {
+            tabIntroDialog.dialog("open");
+            tabIntroDialog.data("wasOpen",true);
+        }
+        // Tabwechsel Warndialog
+        if(tabChangeWarningDialog) {
+            $(function() {
+                tabChangeWarningDialog.dialog({
+                    autoOpen: false,
+                    resizable: false,
+                    modal: true,
+                    buttons: {
+                        "In diesem Tab bleiben": function() {
+                            $("#tabs").removeData("requestedTab");
+                            $("#tabs").removeData("tabChangeDialogOpen");
+                            $(this).dialog( "close" );
+                        },
+                        "Tab wechseln": function() {
+                            $(this).dialog( "close" );
+                            var newTabID =$("#tabs").data("requestedTab");
+                            $("#tabs").removeData("requestedTab");
+                            $("#tabs").tabs("option", "active", newTabID);
+                            $("#tabs").removeData("tabChangeDialogOpen");
+                        }   
+                    }
+                });
+            });
+        }
+    };
+    
+    /**
+     * Animiert die Legende: Buttons zum maximieren / minimieren, Icons in den
+     * Buttons, Tooltipp für Vorgängerkante
+     * @method
+     */
+    this.animateLegende = function() {
+        legendeMaxButton.button({icons: {primary: "ui-icon-minus"},text: false});
+        legendeMinButton.button({icons: {primary: "ui-icon-plus"},text: false});
+        this.maximizeLegend();
+        legendeMaxButton.on("click.CanvasDrawer",this.minimizeLegend);
+        legendeMinButton.on("click.CanvasDrawer",this.maximizeLegend);
+        $("tr.LegendeZeileClickable").tooltip();
+    };
+    
+//     /**
+//      * Fügt ein "Neu laden" Icon zum Tab hinzu, aktiviert es
+//      * @method
+//      */
+//     this.addRefreshToTabbar = function() {
+//         $("#tabs").find(".ui-tabs-active").append('<span class="ui-icon ui-icon-refresh" style="display:inline-block">Klicke auf den Titel des Tabs, um ihn zurückzusetzen.</span>');
+//         $("#tabs").find(".ui-tabs-active").attr("title","Klicke auf den Titel des Tabs, um ihn zurückzusetzen.").tooltip();
+//         $("#tabs").tabs("refresh");
+//         $("#tabs").find(".ui-tabs-active").find("span").on("click.Refresh",function(e) {
+//             e.stopPropagation();
+//             algo.refresh();
+//         });
+//     };
+    
+//     /**
+//      * Entfernt das neu laden Icon und die Funktionalität
+//      * @method
+//      */
+//     this.removeRefreshFromTabbar = function() {
+//         $("#tabs").find(".ui-tabs-active").tooltip().tooltip("destroy");
+//         $("#tabs").find(".ui-tabs-active").find("span").off(".Refresh");
+//         $("#tabs").find(".ui-icon-refresh").remove();
+//         $("#tabs").tabs("refresh");
+//     };
+}
+
+Tab.prototype.init = function(){
+    this._init();
+}
+
+Tab.prototype.activate = function(){
+    this._activate();
+}
+
+Tab.prototype.deactivate = function(){
+    this._deactivate();
+}
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/implementation-doc/library-d3-svg_js_siteAnimation.js.html b/implementation-doc/library-d3-svg_js_siteAnimation.js.html new file mode 100644 index 0000000..a756fc2 --- /dev/null +++ b/implementation-doc/library-d3-svg_js_siteAnimation.js.html @@ -0,0 +1,311 @@ + + + + + JSDoc: Source: library-d3-svg/js/siteAnimation.js + + + + + + + + + + +
+ +

Source: library-d3-svg/js/siteAnimation.js

+ + + + + + +
+
+
var graphEditorTab = null, algorithmTab = null;
+
+function svgHack(){
+//add arrowhead
+    var defs = d3.select("body").append("svg")
+        .attr("id","graph-defs")
+        .append("defs")
+
+     defs.append("marker")
+        .attr("id", "arrowhead2")
+        .attr("refX",24) /*must be smarter way to calculate shift*/
+        .attr("refY",4)
+        .attr("markerUnits","userSpaceOnUse")
+        .attr("markerWidth", 24)
+        .attr("markerHeight", 8)
+        .attr("orient", "auto")
+        .append("path")
+        .attr("d", "M 0,0 V 8 L12,4 Z"); //this is actual shape for arrowhead
+
+     defs.append("marker")
+        .attr("id", "arrowhead3")
+        .attr("refX",24) /*must be smarter way to calculate shift*/
+        .attr("refY",4)
+        .attr("markerUnits","userSpaceOnUse")
+        .attr("markerWidth", 24)
+        .attr("markerHeight", 8)
+        .attr("orient", "auto-start-reverse")
+        .append("path")
+        .attr("d", "M 0,0 V 8 L12,4 Z"); //this is actual shape for arrowhead
+
+
+
+//replace img with svg
+
+//     //http://www.mediaevent.de/svg-in-html-seiten/
+    var imgs = d3.selectAll("img");
+
+// //    var sources = imgs[0].map(function(d){return d.src});
+
+   imgs.attr("src",function(a,b,c){
+       var src = this.src;
+       var selection = d3.select(this);
+       if(src.indexOf(".svg")==src.length-4){
+           d3.text(src, function(error,text){
+//             console.log(selection.html());
+//             d3.select("#svgtest").html(text);
+            var parent = d3.select(selection.node().parentNode)
+                
+//                 parent.append("p").text("test");
+                parent.insert("span","img").html(text);
+                var newSVGElem = parent.select("span").select("svg");
+
+                newSVGElem.attr("class","svgText");
+
+               selection.remove();
+
+//             var foo = selection.node().parentNode.innerHtml; //).append("div").html(text);
+        });
+       }
+       return src;
+   })
+}
+
+
+function svgSerialize(svgHtml){//Node){
+//   if(styles){
+//     //svg.select('defs').select('style').text('<![CDATA['+styles+']]>')
+
+//     var header ='<svg width="'+ww+'" height="'+hh+'" version="1.1" xmlns="http://www.w3.org/2000/svg">';
+//     header +='<defs>';
+//     //inline arrowhead marker style
+//     header += d3.select('#graph-defs').select('defs').html();
+//     //inline css styles
+//     header += '<style type="text/css"> <![CDATA['+styles+']]> </style>';
+//     header += '</defs>';
+//     header +=svgNode.innerHTML;
+//     header +='</svg>';
+
+//    return 'data:image/svg+xml;utf8,'+header;
+//   }
+
+
+
+  //use jquery to get the svg xml, doesnt work with d3.
+  //var svgContainer = that.tab.find('.svgContainer');//.clone();
+  //var svg = svgContainer.find(".graphCanvas");
+//   d3.select(this).attr({ version: '1.1' , xmlns:"http://www.w3.org/2000/svg"});
+  //var svgHtml = svgContainer.html();
+
+  //var svgHtml = (new XMLSerializer()).serializeToString(svgNode);//svgOrigin.node()
+  //var seed = 50 + Math.floor(Math.random()*1000000); //lower 50 ones are reserved for my own use
+
+  //svgHtml = svgHtml.replace(/arrowhead2/g,"arrowhead"+seed);
+
+  //                 svgHtml = '<?xml-stylesheet type="text/css" href="href="../library-d3-svg/css/graph-style.css" ?>' + svgHtml;
+
+  var b64 = btoa(svgHtml); // or use btoa if supported
+
+  // Works in recent Webkit(Chrome)
+  //      $("body").append($("<img src='data:image/svg+xml;base64,\n"+b64+"' alt='file.svg'/>"));
+
+  // Works in Firefox 3.6 and Webit and possibly any browser which supports the data-uri
+  //      $("body").append($("<a href-lang='image/svg+xml' href='data:image/svg+xml;base64,\n"+b64+"' title='file.svg'>Download</a>"));
+
+
+  var href = "data:image/svg+xml;base64,\n"+b64;
+  return href;
+}
+
+//http://spin.atomicobject.com/2014/01/21/convert-svg-to-png/
+//http://techslides.com/save-svg-as-an-image
+function svgSerializeAndCrop(svgNode,styles,crop){
+  var sel=d3.select(svgNode);
+  var algo = GraphAlgos.get(sel.attr("id"));
+
+  var oldId = sel.attr("id");
+  var oldClass = sel.attr("class");
+  sel.attr("id",null);
+  sel.attr("class",null);
+
+  if(algo && crop){
+    var nodes = Graph.instance.getNodes();
+
+    var screenCoords = nodes.map(algo.nodePos.bind(algo));
+
+    var xR = d3.extent(screenCoords,function(d){return d.x});
+    var yR = d3.extent(screenCoords,function(d){return d.y});
+
+    var transl = "translate(-"+xR[0]+",-"+yR[0]+")";
+
+    var oldWidth = sel.attr("width");
+    var oldHeight = sel.attr("height");
+    var width = xR[1]-xR[0]+algo.margin.left+algo.margin.right;
+    var height = yR[1]-yR[0]+algo.margin.top+algo.margin.bottom;
+
+    //use d3 to select transform, doesnt work with jqyery since it selects all g's, not just the top level one;
+    var oldTra = sel.select("g").attr("transform");
+
+    sel.select("g").attr("transform",oldTra+","+transl);//.each("end",function(){
+    sel.attr("width",width);
+    sel.attr("height",height);
+    sel.attr("viewBox","0 0 "+width+" "+height);//http://stackoverflow.com/questions/19484707/how-can-i-make-an-svg-scale-with-its-parent-container
+  }
+
+    //inline arrowhead marker style
+  var header = d3.select('#graph-defs').select('defs').html()+'\n';
+  var defs = sel.insert('defs',"g").html(header);
+
+      //inline css style
+  var styles = styles.replace(/(\r\n|\n|\r)/gm," ");
+
+  //var header2 = '<style type="text/css"> <![CDATA['+styles+']]> </style>';
+
+  var styleSel = defs.append("style").attr("type","text/css");
+  styleSel.text('<![CDATA['+styles+"]]>");
+
+ // var svgHtmlinner = sel.html();
+
+  var svgHtml = sel.node().outerHTML;
+  svgHtml = svgHtml.replace("&lt;","<").replace("&gt;",">");
+
+  var href = svgSerialize(svgHtml);
+
+  if(algo && crop){
+    //move back
+    sel.attr("viewBox",null);
+    sel.attr("width",oldWidth);
+    sel.attr("height",oldHeight);
+    sel.select("g").attr("transform",oldTra);
+  }
+
+  sel.attr("id",oldId);
+  sel.attr("class",oldClass);
+
+  defs.remove();
+
+
+  return href;
+}
+
+function svgGraphCanvasDownloadable(){
+   var container = d3.selectAll(".svgContainer");
+   //contains a svg and an a
+   var links = container.selectAll('a');
+   var svgOrigins = container.selectAll('svg');
+   var styles;
+   //async query styles from css file
+   d3.text(d3.select("#graph-style").attr("href"),function(s){styles = s});
+
+
+   links.on('mousedown',function(a,b,c){
+     var node = svgOrigins[c][0];
+
+     var href = svgSerializeAndCrop(node,styles);
+
+     var ahref = d3.select(this);
+     ahref.property("href-lang","image/svg+xml");
+     ahref.property("href",href);
+//      window.location=data;
+   })
+}
+
+
+/**
+ * Initializes the page layout of all interactive tabs
+ * @author Adrian Haarbach
+ * @global
+ * @function
+ */
+function initializeSiteLayout(GraphAlgorithmConstructor) {
+
+    $("button").button();
+    $("#te_button_gotoDrawGraph").click(function() { $("#tabs").tabs("option", "active", 1);});
+    $("#te_button_gotoIdee").click(function() { $("#tabs").tabs("option", "active", 3);});
+    $("#ti_button_gotoDrawGraph").click(function() { $("#tabs").tabs("option", "active", 1);});
+    $("#ti_button_gotoAlgorithm").click(function() { $("#tabs").tabs("option", "active", 2);});
+    $("#tw_Accordion").accordion({heightStyle: "content"});
+    
+    graphEditorTab = new GraphEditorTab(new GraphEditor(d3.select("#tg_canvas_graph")),$("#tab_tg"));
+    graphEditorTab.init();
+    
+    algorithmTab = new AlgorithmTab(new GraphAlgorithmConstructor(d3.select("#ta_canvas_graph"),d3.select("#ta_canvas_graph2")),$("#tab_ta"));
+    algorithmTab.init();
+  
+    $("#tabs").tabs({
+        beforeActivate: function(event, ui) {
+            var id = ui.oldPanel[0].id;
+            if(id == "tab_tg") { /** graph editor tab */
+                graphEditorTab.deactivate();
+            }else if(id == "tab_ta") { /** graph algorithm tab */
+                algorithmTab.deactivate();
+            }
+        },
+        activate: function(event, ui) {
+            var id = ui.newPanel[0].id;
+            if(id == "tab_tg") {
+                graphEditorTab.activate();
+            } else if(id == "tab_ta") {
+                algorithmTab.activate();
+            }
+        }
+    });
+
+   svgHack();
+   svgGraphCanvasDownloadable();
+}
+
+
+//http://stackoverflow.com/questions/979975/how-to-get-the-value-from-the-get-parameters
+function getUrlVars() {
+    var vars = {};
+    var parts = window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi,    
+    function(m,key,value) {
+      vars[key] = value;
+    });
+    return vars;
+  }
+
+function getUrlHash() {
+  return window.location.hash;
+}
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/implementation-doc/maxflow-push-relabel_js_GoldbergTarjanPushRelabelAlgorithm.js.html b/implementation-doc/maxflow-push-relabel_js_GoldbergTarjanPushRelabelAlgorithm.js.html new file mode 100644 index 0000000..258ff56 --- /dev/null +++ b/implementation-doc/maxflow-push-relabel_js_GoldbergTarjanPushRelabelAlgorithm.js.html @@ -0,0 +1,726 @@ + + + + + JSDoc: Source: maxflow-push-relabel/js/GoldbergTarjanPushRelabelAlgorithm.js + + + + + + + + + + +
+ +

Source: maxflow-push-relabel/js/GoldbergTarjanPushRelabelAlgorithm.js

+ + + + + + +
+
+

+var STATUS_SELECTSOURCE = 0;
+var STATUS_SELECTTARGET = 1;
+var STATUS_START = 2;
+var STATUS_INITPREFLOW = 3;
+var STATUS_INITDISTANCEFUNCTION = 4;
+var STATUS_MAINLOOP = 5;
+var STATUS_ADMISSIBLEPUSH = 6;
+var STATUS_PUSH = 7;
+var STATUS_ADMISSIBLERELABEL = 8;
+var STATUS_RELABEL = 9;
+var STATUS_FINISHED = 10;
+
+/**
+ * Goldberg Tarjan's Push-Relabel Algorithmus
+ * @author Adrian Haarbach
+ * @augments GraphDrawer
+ * @class
+ */
+function GoldbergTarjanPushRelabelAlgorithm(svgSelection,svgSelection2) {
+  GoldbergTarjanPushRelabelAlgorithmInstance=this;
+    GraphDrawer.call(this,svgSelection);
+
+    /**
+     * closure variables for this class
+     * @type GoldbergTarjanPushRelabelAlgorithm
+     */
+    var that = this;
+    var algo = that;
+    
+    /** 
+     * debug states for replay steps to console
+     */
+    var debugConsole = false;
+    
+    /**
+     * the logger instance
+     * @type Logger
+     */
+    var logger = new Logger(d3.select("#logger"),d3.select("#loggerLastEntry"));
+
+    /**
+     * The canvas to draw the residual graph with height and excess axes
+     */
+    var residualGraphDrawer = new ResidualGraphDrawer(svgSelection2,this);
+
+    /**
+     * status variables
+     * @type Object
+     */
+    var s = null;
+
+    /**
+     * getter for status variable
+     */
+    this.getState = function(){
+      return s;
+    }
+
+    /**
+     * thickness of edges depending on flow going through
+     */
+    function flowWidth(val,s) {
+        var s=s || 25;
+        var maxCap = d3.max(Graph.instance.getEdges(), function(d) {
+            return d.resources[0]
+        });
+        return s * (val / maxCap);
+    }
+    this.flowWidth = flowWidth;
+    
+    /**
+     * The text to appear inside the nodes 
+     * @override
+     */
+    this.nodeLabel = function(d) {
+        if (d.id == s.sourceId)
+            return "s";
+        else if (d.id == s.targetId)
+            return "t";
+        else
+            return d.id;
+    }
+
+    /**
+     * The text to appear on top of the nodes 
+     * @override
+     */
+//     this.nodeText = function(d){
+//       return "[" + d.state.height +","+d.state.excess+"]";
+//     }
+    
+    /**
+     * The text to appear halfway along the edge
+     * display current flow along edge together with the maximum capacity of the edge
+     * @override
+     */
+    this.edgeText = function(d) {
+        return d.state.flow + "/" + d.resources[0];
+    }
+    
+    /**
+     * called for each newly added node
+     * attach onClick listeners so we can select start/target node
+     * @override
+     */
+    this.onNodesEntered = function(selection) {
+        //select source and target nodes
+        selection
+          .on("click", function(d) {
+              if (s.id == STATUS_SELECTSOURCE || s.id == STATUS_SELECTTARGET && d.id != s.sourceId) {
+                  that.nextStepChoice(d);
+              }
+          })
+    }
+    
+    /**
+     * called after each call to update()
+     * fill start/target, current and active nodes in green, red and yellow
+     * @override
+     */
+    this.onNodesUpdated = function(selection) {
+      selection
+        .selectAll("circle")
+        .style("fill", function(d) {
+            if (d.id == s.currentNodeId){
+              return const_Colors.CurrentNodeColor;
+            }else if (d.id == s.sourceId)
+                return const_Colors.StartNodeColor; //green
+            else if (d.id == s.targetId)
+                return const_Colors.StartNodeColor;//NodeFillingQuestion; // NodeFillingLight
+            else if (s.activeNodeIds.indexOf(d.id) >= 0)
+                return const_Colors.PQColor;
+            else
+                return global_NodeLayout['fillStyle'];
+        //        return colormap[Math.min(10,d.height)];
+        })
+    }
+    
+    /**
+     * called for each newly added edge
+     * Add gray capacity and blue flow lines behind the line with arrow from GraphDrawer
+     * @override
+     */
+    this.onEdgesEntered = function(selection) {
+         selection.append("line")
+            .attr("class", "cap")
+            .style("stroke-width",function(d){return algo.flowWidth(d.resources[0])})
+
+          selection.append("line")
+            .attr("class", "flow")
+    }
+    
+    /**
+     * called after each call to update()
+     * Update the current flow width of an edge. 
+     * Highlight edges e in G along which we push / use for relabeling a node
+     * @override
+     */
+    this.onEdgesUpdated = function(selection) {
+        selection.selectAll("line.flow")
+            .style("stroke-width",function(d){
+              return algo.flowWidth(Graph.instance.edges.get(d.id).state.flow)
+              })
+        
+
+        selection.selectAll("line.arrow")
+            .each(function(d){
+              var attr = {"stroke":"black","stroke-width":global_Edgelayout['lineWidth'],"marker-end":"url(#arrowhead2)"};
+              if(s.e_dash && d.id == s.e_dash.id){// && (s.idPrev==STATUS_PUSH || s.idPrev==STATUS_ADMISSIBLEPUSH || s.idPrev==STATUS_RELABEL)){
+                attr["stroke-width"]=4;
+                attr["stroke"]="orange";
+                //attr["marker-end"]="url(#arrowhead2-red)";
+              }else if(s.e_star && d.id == s.e_star.id){
+                attr["stroke-width"]=4;
+                attr["stroke"]="green";
+                //attr["marker-end"]="url(#arrowhead2-green)";
+              }
+              d3.select(this).style(attr);
+            })
+    }
+
+
+    /**
+     * Replay stack, saves all states of the algorithm for rewinding.
+     * @type {Array}
+     */
+    var replayHistory = new Array();
+
+    var fastforwardOptions = {label: $("#ta_button_text_fastforward").text(), icons: {primary: "ui-icon-seek-next"}};
+
+    /**
+     * Init the graph network visualization as well as the secondary visualizaiton layer
+     * @method
+     */
+    this.init = function() {
+
+        Graph.addChangeListener(function(){
+            that.clear();
+            that.reset();
+            that.squeeze();
+            that.update();
+        });
+
+        this.reset();
+        this.update();
+
+        residualGraphDrawer.init();
+    };
+
+    /**
+     * Clear all states
+     * @method
+     */
+    this.reset = function(){
+        s = {
+            id: 0, //status id
+            idPrev:0,
+            currentNodeId: -1,
+            activeNodeIds: [],
+            sourceId: -1,
+            targetId: -1,
+            mainLoopIt: 0,
+            e_dash:null,
+            e_star:null,
+            e_dashes_forward_star_map:null //maps each edge id to outgoing residual edge from currentNodeId used in ResidualGraphDrawer.js
+        };
+
+        setStatus(STATUS_SELECTSOURCE)
+
+        this.replayHistory = [];
+
+        if(Graph.instance){
+            logger.reset();
+            //prepare graph for this algorithm: add special properties to nodes and edges
+            Graph.instance.nodes.forEach(function(key, node) {
+                node.state.height = 0;
+                node.state.excess = 0;
+                node.state.visited=false;
+            })
+
+            Graph.instance.edges.forEach(function(key, edge) {
+                edge.state.flow = 0;
+            })
+
+          //debug: no need to click on source and target initially
+          this.nextStepChoice(Graph.instance.nodes.get(0),true);
+          this.nextStepChoice(Graph.instance.nodes.get(Graph.instance.nodeIds-1),true);
+        }
+    }
+
+    /**
+     * make the view consistent with the state
+     * @method
+     */
+    this.update = function(){
+
+        this.updateDescriptionAndPseudocode();
+        logger.update();
+
+
+        if(Graph.instance){
+             residualGraphDrawer.update(s);
+             GoldbergTarjanPushRelabelAlgorithm.prototype.update.call(this); //updates the graph
+        }
+    }
+
+    /**
+     * tab comes into view
+     * @method
+     */
+    this.activate = function() {
+        this.reset();
+        this.squeeze();
+        this.update();
+    };
+
+    /**
+     * tab disappears from view
+     * @method
+     */
+    this.deactivate = function() {
+        this.stopFastForward();
+        this.replayHistory = [];
+    };
+    
+    
+    this.setDisabledBackward = function(disabled) {
+        $("#ta_button_Zurueck").button("option", "disabled", disabled);
+    };
+    
+    this.setDisabledForward = function(disabled, disabledSpulen) {
+        var disabledSpulen = (disabledSpulen!==undefined) ? disabledSpulen : disabled;
+        $("#ta_button_1Schritt").button("option", "disabled", disabled);
+        $("#ta_button_vorspulen").button("option", "disabled", disabledSpulen);
+    };
+
+    /**
+     * add a step to the replay stack, serialize stateful data
+     * @method
+     */
+    this.addReplayStep = function() {
+        
+        replayHistory.push({
+            "graphState": Graph.instance.getState(),
+            "s": JSON.stringify(s),
+            "legende": $("#tab_ta").find(".LegendeText").html(),
+            "loggerState": logger.getState()
+        });
+        
+        if (debugConsole) console.log("Current History Step: ", replayHistory[replayHistory.length - 1]);
+    };
+
+    /**
+     * playback the last step from stack, deserialize stateful data
+     * @method
+     */
+    this.previousStepChoice = function() {
+        
+        var oldState = replayHistory.pop();
+        if (debugConsole) console.log("Replay Step", oldState);
+        
+        Graph.instance.setState(oldState["graphState"]);
+        s = JSON.parse(oldState["s"]);
+        logger.setState(oldState["loggerState"]);
+        $("#tab_ta").find(".LegendeText").html(oldState["legende"]);
+        
+        this.update();
+    };
+
+    /**
+     * updates status description and pseudocode highlight based on current s.id
+     * @method
+     */
+    this.updateDescriptionAndPseudocode = function() {
+        var sel = d3.select("#ta_div_statusPseudocode").selectAll("div").selectAll("p")
+        sel.classed("marked", function(a, pInDivCounter, divCounter) {
+            return divCounter == s.idPrev;
+        });
+        
+        var sel = d3.select("#ta_div_statusErklaerung").selectAll("div");
+        sel.style("display", function(a, divCounter) {
+            return (divCounter == s.idPrev) ? "block" : "none";
+        });
+
+        var vText = "-";
+        if(Graph.instance){
+          var v = Graph.instance.nodes.get(s.currentNodeId);
+          if(v){
+            vText = v.id;// +", e(v)="+ v.state.excess;
+          }
+        }
+
+        d3.select("#ta_td_v").text(vText);
+        d3.select("#ta_td_queue").text("{"+s.activeNodeIds.join(",")+"}");
+        
+        if(s.e_dash){
+        var e_dash = new Graph.ResidualEdge(s.e_dash);
+          d3.select("#ta_td_e_dash").text(e_dash.toString());
+        }else{
+          d3.select("#ta_td_e_dash").text('-');
+        }
+
+        if(s.e_star){
+        var e_star = new Graph.ResidualEdge(s.e_star);
+          d3.select("#ta_td_e_star").text(e_star.toString());
+        }else{
+          d3.select("#ta_td_e_star").text('-');
+        }
+
+        if(this.fastForwardIntervalID != null){
+            this.setDisabledForward(true,false);
+            this.setDisabledBackward(true);
+        }else if (s.id == STATUS_SELECTSOURCE) {
+            this.setDisabledBackward(true);
+            this.setDisabledForward(true);
+        } else if (s.id == STATUS_SELECTTARGET) {
+            this.setDisabledForward(true);
+        } else if (s.id == STATUS_FINISHED) {
+            this.setDisabledForward(true);
+            this.setDisabledBackward(false);
+        }else{
+            this.setDisabledForward(false);
+            this.setDisabledBackward(false);
+        }
+//         $("#ta_button_1Schritt").button("option", "disabled", true);
+//         $("#ta_button_Zurueck").button("option", "disabled", true);
+//         $("#ta_button_rewind").button("option", "disabled", true);
+    };
+
+    function setStatus(newStatus,oldStatus){
+      s.idPrev = (oldStatus != null) ? oldStatus : s.id;
+      s.id = newStatus;
+    }
+
+
+    ///////////////////////
+    ///Actual algorithm steps
+
+    /**
+     * Executes the next step in the algorithm
+     * @method
+     */
+    this.nextStepChoice = function(d,noGuiUpdate) {
+        
+        if (debugConsole) console.log("Current State: " + s.id);
+
+        // Speichere aktuellen Schritt im Stack
+        this.addReplayStep();
+        
+        switch (s.id) {
+            case STATUS_SELECTSOURCE:
+                selectSource(d);
+                break;
+            case STATUS_SELECTTARGET:
+                selectTarget(d);
+                break;
+            case STATUS_START: //TODO: is never called
+                logger.log("Now the algorithm can start");
+                setStatus(STATUS_INITPREFLOW); //nothing really to do
+                break;
+            case STATUS_INITPREFLOW:
+                initPreflow();
+                break;
+            case STATUS_INITDISTANCEFUNCTION:
+                initDistanceFunction();
+                break;
+            case STATUS_MAINLOOP:
+                mainLoop();
+                break;
+            case STATUS_ADMISSIBLEPUSH:
+                admissiblePush();
+                break;
+            case STATUS_PUSH:
+                push();
+                break;
+            case STATUS_ADMISSIBLERELABEL:
+                admissibleRelabel();
+                break;
+            case STATUS_RELABEL:
+                relabel();
+                break;
+            case STATUS_FINISHED:
+                this.stopFastForward();
+                break;
+            default:
+                console.log("Fehlerhafter State");
+                break;
+        }
+
+        //update view with status values
+        if(!noGuiUpdate) this.update();
+    };
+
+
+    /**
+     * select the source node
+     */
+    function selectSource(d) {
+        s.sourceId = d.id;
+        that.setDisabledBackward(false);
+        setStatus(STATUS_SELECTTARGET,STATUS_SELECTTARGET); //so that idPrev == id so that we see "select target" after we clicked on source node
+        logger.log("selected node <span style='color:rgb(51, 204, 51)'>" + d.id + " as source s</span>");
+    };
+
+    /**
+     * select the target node
+     */
+    function selectTarget(d) {
+        s.targetId = d.id;
+        that.setDisabledForward(false);
+        setStatus(STATUS_INITPREFLOW,STATUS_START); //so that after selecting the target, we jump from display before click (on nodes) to display after click (on next button)
+        logger.log("selected node <span style='color:rgb(51, 204, 51)'>" + d.id + " as target t</span>");
+    };
+
+
+    /////////////
+    //following is push relabel algo //corman page 741, ahuja page 227
+
+    /**
+     * initialize the preflow
+     */
+    function initPreflow() {
+        var source = Graph.instance.nodes.get(s.sourceId);
+        var forwardStar = source.getOutEdges();
+
+        var text = "Init preflow: <span style='color:skyblue'>";
+        var text2 = ", add nodes <span style='color:rgb(255, 255, 112)'>";
+
+        for (var i = 0; i < forwardStar.length; i++) {
+            var e = forwardStar[i];
+            //init preflow from source node
+            e.state.flow = e.resources[0];
+            text +="f("+e.start.id+","+e.end.id+")="+e.state.flow+" ";
+            source.state.excess -= e.state.flow;
+            e.end.state.excess = e.state.flow;
+
+            //add node to active queue
+            if (e.end.id != s.targetId) {
+                text2 += e.end.id + " ";
+                s.activeNodeIds.push(e.end.id);
+            }
+        }
+
+        text +="</span>";
+        text2 +="</span> to Q";
+
+        setStatus(STATUS_INITDISTANCEFUNCTION);
+        
+        logger.log(text + text2);//" source excess: " + source.state.excess);
+    }
+
+    /**
+     * initialize the distance function
+     */
+    function initDistanceFunction() {
+        var source = Graph.instance.nodes.get(s.sourceId);
+        var target = Graph.instance.nodes.get(s.targetId);
+        
+        source.state.visited = true;
+        target.state.visited = true;
+        
+        source.state.height = Graph.instance.getNodes().length;
+        target.state.height = 0;
+        
+        var queue = [target];
+
+        var text = "";
+
+        //BFS traversal
+        while (queue.length > 0) {
+            var node = queue.shift();
+            var inEdges = node.getInEdges();
+            for (var i = 0; i < inEdges.length; i++) {
+                var neighbourNode = inEdges[i].start;
+                if (!neighbourNode.state.visited) {
+                    queue.push(neighbourNode);
+                    neighbourNode.state.visited = true;
+                    neighbourNode.state.height = node.state.height + 1;
+                    text +="h("+neighbourNode.id+")="+neighbourNode.state.height+",";
+                }
+            }
+        }
+        
+        setStatus(STATUS_MAINLOOP);
+        logger.log("Init height: h(t)=0,"+text+"h(s)=" + source.state.height);
+    }
+    
+    /**
+     * playback the last step from stack, deserialize stateful data
+     */
+    function updateResidualEdgesForwardStar(id){
+      s.e_dashes_forward_star_map={};
+      if(id==null) return;
+      var v = Graph.instance.nodes.get(id);
+      e_dashes = v.getAllOutgoingResidualEdges(true);
+      for(var i=0; i<e_dashes.length; i++){
+        s.e_dashes_forward_star_map[e_dashes[i].id]=e_dashes[i];
+      }
+    }
+
+    /**
+     * main loop: pops the current node from the queue until empty
+     */
+    function mainLoop() {
+        s.e_star = null;
+        if (s.activeNodeIds.length == 0) {
+            setStatus(STATUS_FINISHED,STATUS_FINISHED); //so that we display finished, not mainloop when done
+            s.currentNodeId=-1;
+            var finalflow = Graph.instance.nodes.get(s.targetId).state.excess;
+            updateResidualEdgesForwardStar(null);
+            that.stopFastForward();
+            d3.select("#finalflow").text(finalflow);
+            logger.log("Finished with a max flow of "+finalflow);
+            return;
+        }
+        
+        s.currentNodeId = s.activeNodeIds.shift();
+        updateResidualEdgesForwardStar(s.currentNodeId);
+
+
+        logger.log("Main loop #" + (s.mainLoopIt++) + ": pop <span style='color:red'>node v=" + s.currentNodeId + "</span> from Q");
+        
+        setStatus(STATUS_ADMISSIBLEPUSH);
+    }
+
+    /**
+     * checks if we can apply a push operation. Together with push() mimics the inner WHILE loop
+     */
+    function admissiblePush() {
+      s.e_dash=null;
+        var v = Graph.instance.nodes.get(s.currentNodeId);
+        if (v.state.excess > 0){
+            s.e_dash = v.getLegalResidualEdge();
+            if(s.e_dash){
+              setStatus(STATUS_PUSH);
+              logger.log2("admissible push on " + s.e_dash.toString());
+            }else{
+              setStatus(STATUS_ADMISSIBLERELABEL);
+              logger.log2("no admissible push, e(v)=" + v.state.excess);
+            }
+        } else {
+          setStatus(STATUS_MAINLOOP);
+        }
+    }
+
+    /**
+     * apply a push operation on the current node
+     */
+    function push() {
+        var v = Graph.instance.nodes.get(s.currentNodeId);
+        var e_dash = new Graph.ResidualEdge(s.e_dash); //e' G'
+        //var edge = e_dash.edge(); //e in G
+        var w = e_dash.end();
+        
+        var delta = Math.min(v.state.excess, e_dash.c_dash());
+        
+        e_dash.increaseFlow(delta);
+        
+        v.state.excess -= delta;
+        w.state.excess += delta;
+        
+        if (w.id != s.sourceId && w.id != s.targetId && s.activeNodeIds.indexOf(w.id) == -1) {
+            s.activeNodeIds.push(w.id);
+        }
+        
+        var sat = e_dash.c_dash() == 0 ? " [saturating] " : " [nonsaturating] ";
+        logger.log3(sat +" push of " + delta + " from node <span style='color:red'>" + that.nodeLabel(v) + "</span> to " + that.nodeLabel(w) + " along red edge");
+        setStatus(STATUS_ADMISSIBLEPUSH);
+    }
+
+    /**
+     * checks if we can apply a relabel operation. This mimics and IF, since relabel() returns to outer while loop
+     */
+    function admissibleRelabel() {
+        var v = Graph.instance.nodes.get(s.currentNodeId);
+        if (v.state.excess > 0 && (s.e_dash = v.getLegalResidualEdge()) == null) { //todo: check if e_dash can ever be not null here, since we pushed till we saturated all edges beforehand anyways
+            setStatus(STATUS_RELABEL);
+            logger.log2("admissible relabel, e(v)=" + v.state.excess);
+        } else {
+            setStatus(STATUS_MAINLOOP); //jump to loop head
+            logger.log2("no admissible relabel");
+        }
+    }
+
+    /**
+     * apply a relabel operation on the current node
+     */
+    function relabel() {
+        var node = Graph.instance.nodes.get(s.currentNodeId);
+        
+        var residualEdges = node.getAllOutgoingResidualEdges();
+
+        //find neighbouring node in G' with lowest height
+        s.e_star = residualEdges[0];
+        for(var i=0; i<residualEdges.length; i++){
+          if(residualEdges[i].end().state.height < s.e_star.end().state.height){
+            s.e_star=residualEdges[i];
+          }
+        }
+        
+        //make ourself 1 higher than him
+        var newheight = 1 + s.e_star.end().state.height;
+
+        logger.log3("relabel node <span style='color:red'>v=" + node.id + "</span> from h=" + node.state.height + " to h=" + newheight+ ", add v to <span style='color:yellow'>Q (yellow)</span>");
+        node.state.height = newheight;
+        s.activeNodeIds.push(node.id);
+        
+        setStatus(STATUS_MAINLOOP);
+    }
+}
+
+// Vererbung realisieren
+GoldbergTarjanPushRelabelAlgorithm.prototype = Object.create(GraphDrawer.prototype);
+GoldbergTarjanPushRelabelAlgorithm.prototype.constructor = GoldbergTarjanPushRelabelAlgorithm;
+
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/implementation-doc/maxflow-push-relabel_js_ResidualEdge.js.html b/implementation-doc/maxflow-push-relabel_js_ResidualEdge.js.html new file mode 100644 index 0000000..0b77255 --- /dev/null +++ b/implementation-doc/maxflow-push-relabel_js_ResidualEdge.js.html @@ -0,0 +1,173 @@ + + + + + JSDoc: Source: maxflow-push-relabel/js/ResidualEdge.js + + + + + + + + + + +
+ +

Source: maxflow-push-relabel/js/ResidualEdge.js

+ + + + + + +
+
+
/**
+ * @classdesc
+ * Represents a residual edge in the residual Graph  G'
+ * @constructor
+ */
+Graph.ResidualEdge = function(idOrObj, forward) {
+  if(idOrObj && forward==null){ //from json.stringify
+    this.id = idOrObj.id;
+    this.forward = idOrObj.forward;
+  }else{ //2 args constructor
+    this.id = idOrObj;
+    this.forward = forward;
+  }
+}
+
+/**
+ * The original edge of the graph G
+ */
+Graph.ResidualEdge.prototype.edge = function(){
+  return Graph.instance.edges.get(this.id);
+}
+
+/**
+ * The residual capacity
+ */
+Graph.ResidualEdge.prototype.c_dash = function(){
+  var edge = this.edge();
+  if (this.forward) {
+      return edge.resources[0] - edge.state.flow;
+  } else {
+      return edge.state.flow;
+  }
+}
+
+Graph.ResidualEdge.prototype.notnull = function(){
+  var c = this.c_dash();
+  return c > 0;
+}
+
+/**
+ * The start vertex
+ */
+Graph.ResidualEdge.prototype.start = function(){
+  var edge = this.edge();
+  if(this.forward){
+    return edge.start;
+  }else{
+    return edge.end;
+  }
+}
+
+/**
+ * The end vertex
+ */
+Graph.ResidualEdge.prototype.end = function(){
+  var edge = this.edge();
+  if(this.forward){
+    return edge.end;
+  }else{
+    return edge.start;
+  }
+}
+
+Graph.ResidualEdge.prototype.legal = function(){
+  return this.start().state.height == this.end().state.height + 1 
+}
+
+Graph.ResidualEdge.prototype.increaseFlow = function(delta){
+  var edge = this.edge();
+  if (this.forward) {
+      edge.state.flow += delta;
+  } else {
+      edge.state.flow -= delta;
+  }
+}
+
+Graph.ResidualEdge.prototype.toString = function() {
+  return (this.forward ? "forward " : "backward ") + "residual edge e'=("+this.start().id + "," + this.end().id + ") with c'=" + this.c_dash();
+}
+
+//not necessarily legal, forward star of node in G'
+Graph.Node.prototype.getAllOutgoingResidualEdges = function(unfiltered) {
+  var e_dashes = [];
+
+  /*forward edges*/
+  this.outEdges.forEach(function(key, edge) {
+      e_dashes.push(new Graph.ResidualEdge(key, true));
+  });
+
+  /*backward edges*/
+  this.inEdges.forEach(function(key, edge) {
+      e_dashes.push(new Graph.ResidualEdge(key, false));
+  });
+
+  if(unfiltered) return e_dashes;
+
+  //If capacity == 0, we don't speak of an residual edge anymore
+  var filteredEdges = e_dashes.filter(function(e_dash) {
+      return e_dash.notnull();
+  });
+
+  return filteredEdges;
+}
+
+//function getLegalResidualEdge(node) {
+Graph.Node.prototype.getLegalResidualEdge = function(node){
+
+  var arrEdges = [this.outEdges.keys(),this.inEdges.keys()];
+  var arrForward = [true,false];
+
+  for(var i=0; i<2; i++){
+    var ids = arrEdges[i];
+    for(var j=0; j<ids.length; j++){
+      var id = ids[j];
+      var e_dash = new Graph.ResidualEdge(id, arrForward[i]);
+      if(e_dash.notnull() && e_dash.legal()){
+        return e_dash;
+      }
+    }
+  }
+  
+  return null;
+}
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/implementation-doc/maxflow-push-relabel_js_ResidualGraphDrawer.js.html b/implementation-doc/maxflow-push-relabel_js_ResidualGraphDrawer.js.html new file mode 100644 index 0000000..8d58be6 --- /dev/null +++ b/implementation-doc/maxflow-push-relabel_js_ResidualGraphDrawer.js.html @@ -0,0 +1,355 @@ + + + + + JSDoc: Source: maxflow-push-relabel/js/ResidualGraphDrawer.js + + + + + + + + + + +
+ +

Source: maxflow-push-relabel/js/ResidualGraphDrawer.js

+ + + + + + +
+
+
/**
+ * @classdesc
+ * Secondary visualization layer to draw the residual graph
+ * @constructor
+ */
+var ResidualGraphDrawer = function(svgOrigin,algo){
+    var leftMargin = 10;
+    GraphDrawer.call(this,svgOrigin,{left:leftMargin});
+
+    GraphAlgos.remove(svgOrigin.attr("id"),this);
+
+
+    this.x.domain([0,10]);
+    this.y.domain([0,10]);
+
+    this.nodeLabel = function(d){
+        return algo.nodeLabel(d);
+    };
+
+    this.nodeText = function(d){
+        return algo.nodeText(Graph.instance.nodes.get(d.id));
+    }
+
+    /**
+     * Edge text is capacity c' of residual edges e' in G'
+     */
+    this.edgeText = function(d) {
+      var e_dashes_forward_map = algo.getState().e_dashes_forward_star_map;
+
+      if(e_dashes_forward_map){
+        var e_dash = e_dashes_forward_map[d.id];
+        if(!e_dash) return "";
+        var resEdge = new Graph.ResidualEdge(e_dash);
+        return resEdge.c_dash();// + " " + (resEdge.forward ? "f" : "b"); //d.id + " "
+      }
+      return "";
+    }
+
+    /**
+     * Add Rectangle(excessBar) and Text (height,excess) to nodes.
+     */
+    this.onNodesEntered = function(selection){
+        algo.onNodesEntered(selection);
+
+        selection.append("rect")
+          .attr("class", "excessBar unselectable")
+          .attr("x", "20")
+          .attr("width", 10);
+      /*
+        selection.append("text")
+          .attr("class","height")
+          .attr("dy", "-1.2em")           // set offset y position
+          .attr("text-anchor", "left");
+
+        selection.append("text")
+          .attr("class","excess unselectable")
+          .attr("dy", "2.0em")           // set offset y position
+          .attr("text-anchor", "right");
+          */
+    }
+
+    /**
+     * Update Rectangle(excessBar) and Text (height,excess) at nodes. Display of these depends on current selected xFunName
+     */
+    this.onNodesUpdated = function(selection){
+      algo.onNodesUpdated(selection);
+
+     var h = 20;
+
+     selection.selectAll(".excessBar")
+       .transition(100)
+       .attr("y", function(d) {
+           return h - algo.flowWidth(Math.abs(Graph.instance.nodes.get(d.id).state.excess),50)
+       })
+       .attr("height", function(d) {
+           return algo.flowWidth(Math.abs(Graph.instance.nodes.get(d.id).state.excess),50)
+       })
+       .style("display",(algo.getState().id == STATUS_FINISHED || xFunName==AXIS_EXCESS) ? "none" : "block");
+      /*
+     selection.selectAll(".height")
+       .transition()
+       .text(function(d){return "h:"+d.state.height});
+
+     selection.selectAll(".excess")
+       .transition()
+       .text(function(d){return "e:"+d.state.excess})
+       */
+    }
+
+    this.nodeText = function(d){
+      if(xFunName==AXIS_EXCESS) return "";
+      if(xFunName==AXIS_ID) return " / "+d.state.excess;
+      return d.state.height + " / " + d.state.excess;
+    }
+
+    this.onEdgesEntered = function(selection) {
+
+    }
+    
+    this.onEdgesUpdated = function(selection) {
+      //does not update flow with and cap because we didnt call algo.onEdgesEntered 
+      //in this.onEdgesEntered, so only the default onEdgesEntered with arrows from GraphDrawer is called on enter
+      //TODO:: draw residual edges on active node, not all edges in right side
+      algo.onEdgesUpdated(selection);
+
+      selection.selectAll("line.arrow")
+        .each(function(d){
+          var isResidualEdge = false;
+          var e_dashes_forward_map = algo.getState().e_dashes_forward_star_map;
+      
+          //var currentNodeId = algo.getState().currentNodeId;
+
+          
+          if(e_dashes_forward_map){//currentNodeId != null && currentNodeId>=0){
+//             var currentNode = Graph.instance.nodes.get(currentNodeId);
+//             var e_dashes = currentNode.getAllOutgoingResidualEdges(true);
+
+//             var e_dash = null;
+//             for(var i=0; i<e_dashes.length; i++){
+//               if(d.id == e_dashes[i].id){
+//                 e_dash=e_dashes[i];
+//                 break;
+//               }
+//             }
+            var e_dash = e_dashes_forward_map[d.id];
+            var isResidualEdge = e_dash != null;
+            d3.select(this).style("visibility",isResidualEdge ? "visible" : "hidden");
+            if(isResidualEdge){
+              var resEdge = new Graph.ResidualEdge(e_dash);
+              d3.select(this).style("stroke-dasharray","5,5");
+              d3.select(this).style("marker-start",e_dash.forward ? "" : "url(#arrowhead3)");
+              d3.select(this).style("marker-end",e_dash.forward ? "url(#arrowhead2)" : "");
+              //d3.select(this).style("opacity",resEdge.notnull() ? 1 : 0.1);
+            }
+          }else{
+             d3.select(this).style("visibility","hidden");
+          }
+        });
+
+      //on g.edge
+      selection.style("opacity",function(d){ //selectAll("line.arrow").transition()
+        var e_dashes_forward_map = algo.getState().e_dashes_forward_star_map;
+        var op = 1;
+        if(e_dashes_forward_map){
+          var e_dash = e_dashes_forward_map[d.id];
+          if(e_dash){
+            var resEdge = new Graph.ResidualEdge(e_dash);
+            if(!resEdge.legal()){
+              op = 0.3;
+            }
+            if(!resEdge.notnull()){
+              op = 0.3;
+            }
+          }
+        }
+        return op;
+      });
+    }
+
+    var that = this;
+
+    this.init = function(){
+      Graph.addChangeListener(function(){
+          that.clear();
+          that.update();
+      });
+    }
+
+    var AXIS_EXCESS = "height/excess";//"excess";
+    var AXIS_ID = "height/id";// "id"
+    var AXIS_GRAPH = "y/x";//graph";
+
+
+    var axisOptions = {};
+    axisOptions[AXIS_EXCESS] = {
+      "x" : function(d){return +d.state.excess},
+      "y" : function(d){return +d.state.height}
+    };
+    axisOptions[AXIS_ID] = {
+      "x" : function(d){return +d.id},
+      "y" : function(d){return +d.state.height}
+    };
+    axisOptions[AXIS_GRAPH] = {
+      "x" : function(d){return +d.x},
+      "y" : function(d){return +d.y}
+    }
+
+    var selectBox = d3.select("#heightFunctionXAxis");
+    var heightFunctionXAxisKeepFixed = d3.select("#heightFunctionXAxisKeepFixed");
+
+    
+    var xFunName=selectBox.property("value");
+
+    selectBox.on('change',function(e){
+      that.setXFunName(this.value);
+    });
+
+    this.setXFunName = function(name,noUpdate){
+      xFunName=name;
+      selectBox.property("value",xFunName); //does not trigger 'change' event
+      var yx = xFunName.split("/");
+      xAxisText.text(yx[1]);
+      yAxisText.text(yx[0]);
+      if(!noUpdate) that.update();
+    }
+
+    var axis = getUrlVars()["axis"];
+    if(axis && axisOptions[axis]){
+      xFunName=axis;
+      selectBox.property("value",xFunName); //does not trigger 'change' event
+      heightFunctionXAxisKeepFixed.property("checked",true);
+    }
+
+
+    function tickForm(e,b){
+        if(Math.floor(e) != e)
+        {
+            return;
+        }
+
+        return e;
+    };
+
+
+    //Axis
+    var xAxis = d3.svg.axis().scale(this.x).orient("bottom").tickFormat(tickForm);
+    var yAxis = d3.svg.axis().scale(this.y).orient("left").tickFormat(tickForm);
+
+    var yx = xFunName.split("/");
+
+    var xAxisText = this.svg.append("g")
+          .attr("class", "x axis")
+          .attr("transform", "translate(0," + (this.height-10) + ")")
+          .call(xAxis)
+        .append("text")
+          .attr("class", "label")
+          .attr("x", this.width)
+          .attr("y", 15)
+          .style("text-anchor", "end")
+          .text(yx[1]);//id
+
+    var yAxisText = this.svg.append("g")
+          .attr("class", "y axis")
+          .attr("transform", "translate("+leftMargin+",0)")
+          .call(yAxis)
+        .append("text")
+          .attr("class", "label")
+//           .attr("transform", "rotate(-90)")
+//           .attr("x",0)
+          //.attr("y", -3)
+          .attr("dy", ".71em")
+          .style("text-anchor", "end")
+          .text(yx[0])
+     
+    /////////////////
+    //PRIVILEDGED
+
+    this.type="ResidualGraphDrawer";
+
+    var that = this;
+
+    this.nodeX = function(d){
+        return axisOptions[xFunName]["x"](d);
+    };
+
+    this.nodeY = function(d){
+        return axisOptions[xFunName]["y"](d);
+    }
+
+    this.update = function(s){
+
+        if(s && !heightFunctionXAxisKeepFixed.property("checked")){
+          if(s.idPrev <= STATUS_INITPREFLOW) this.setXFunName(AXIS_GRAPH,true);
+          else if(s.idPrev == STATUS_INITDISTANCEFUNCTION /* || s.idPrev == STATUS_RELABEL || s.idPrev == STATUS_ADMISSIBLERELABEL*/) this.setXFunName(AXIS_ID,true);
+          //else if(s.idPrev == STATUS_MAINLOOP) this.setXFunName(AXIS_GRAPH,true);
+          else if(s.idPrev >= STATUS_FINISHED) this.setXFunName(AXIS_GRAPH,true);
+          else if(s.idPrev >= STATUS_MAINLOOP) this.setXFunName(AXIS_EXCESS,true);
+        }
+
+        var nodes = Graph.instance.getNodes();
+
+        if(Graph.instance){
+            this.squeeze();
+        }
+
+        yAxis.ticks(d3.max(nodes, function(d){return d.state.height}));
+
+        xAxis.ticks(nodes.length);
+
+//         this.x.domain([0,d3.max(nodes, function(d) { return xFun(d)})]);
+        this.x.domain(d3.extent(nodes, this.nodeX)); 
+        this.y.domain(d3.extent(nodes, this.nodeY));
+
+        var vis = (xFunName==AXIS_GRAPH ? "hidden" : "visible");
+
+        var t = this.svg.transition().duration(250);
+        t.select("g.y.axis").call(yAxis).style("visibility",vis);
+        t.select("g.x.axis").call(xAxis).style("visibility",vis);
+
+        ResidualGraphDrawer.prototype.update.call(this);
+    }
+
+} //end constructor GraphDrawer
+ResidualGraphDrawer.prototype = Object.create(GraphDrawer.prototype);
+ResidualGraphDrawer.prototype.constructor = ResidualGraphDrawer;
+
+
+ + + + +
+ + + +
+ + + + + + + diff --git a/implementation-doc/scripts/linenumber.js b/implementation-doc/scripts/linenumber.js new file mode 100644 index 0000000..8d52f7e --- /dev/null +++ b/implementation-doc/scripts/linenumber.js @@ -0,0 +1,25 @@ +/*global document */ +(function() { + var source = document.getElementsByClassName('prettyprint source linenums'); + var i = 0; + var lineNumber = 0; + var lineId; + var lines; + var totalLines; + var anchorHash; + + if (source && source[0]) { + anchorHash = document.location.hash.substring(1); + lines = source[0].getElementsByTagName('li'); + totalLines = lines.length; + + for (; i < totalLines; i++) { + lineNumber++; + lineId = 'line' + lineNumber; + lines[i].id = lineId; + if (lineId === anchorHash) { + lines[i].className += ' selected'; + } + } + } +})(); diff --git a/implementation-doc/scripts/prettify/Apache-License-2.0.txt b/implementation-doc/scripts/prettify/Apache-License-2.0.txt new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/implementation-doc/scripts/prettify/Apache-License-2.0.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/implementation-doc/scripts/prettify/lang-css.js b/implementation-doc/scripts/prettify/lang-css.js new file mode 100644 index 0000000..041e1f5 --- /dev/null +++ b/implementation-doc/scripts/prettify/lang-css.js @@ -0,0 +1,2 @@ +PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\f\r ]+/,null," \t\r\n "]],[["str",/^"(?:[^\n\f\r"\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*"/,null],["str",/^'(?:[^\n\f\r'\\]|\\(?:\r\n?|\n|\f)|\\[\S\s])*'/,null],["lang-css-str",/^url\(([^"')]*)\)/i],["kwd",/^(?:url|rgb|!important|@import|@page|@media|@charset|inherit)(?=[^\w-]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*)\s*:/i],["com",/^\/\*[^*]*\*+(?:[^*/][^*]*\*+)*\//],["com", +/^(?:<\!--|--\>)/],["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#[\da-f]{3,6}/i],["pln",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i],["pun",/^[^\s\w"']+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[["kwd",/^-?(?:[_a-z]|\\[\da-f]+ ?)(?:[\w-]|\\\\[\da-f]+ ?)*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[["str",/^[^"')]+/]]),["css-str"]); diff --git a/implementation-doc/scripts/prettify/prettify.js b/implementation-doc/scripts/prettify/prettify.js new file mode 100644 index 0000000..eef5ad7 --- /dev/null +++ b/implementation-doc/scripts/prettify/prettify.js @@ -0,0 +1,28 @@ +var q=null;window.PR_SHOULD_USE_CONTINUATION=!0; +(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a= +[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m), +l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/, +q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/, +q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g, +"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a), +a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e} +for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"], +"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"], +H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"], +J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+ +I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]), +["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css", +/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}), +["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes", +hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b= +!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p + + + + JSDoc: Source: spp-rc-label-setting/js/Label.js + + + + + + + + + + +
+ +

Source: spp-rc-label-setting/js/Label.js

+ + + + + + +
+
+
var CONSTRAINED_RESOURCE_INDEX = 0; //constrained time
+var MINIMIZED_RESOURCE_INDEX = 1; //min cost unconstrained but should be minimized.
+
+
+//http://stackoverflow.com/questions/3145030/convert-integer-into-its-character-equivalent-in-javascript
+function idOf(i) {
+    return (i >= 26 ? idOf((i / 26 >> 0) - 1) : '') +
+        'abcdefghijklmnopqrstuvwxyz'[i % 26 >> 0];
+}
+
+/**
+ * A Label, built as a tree starting from the primitive label
+ *
+ * A label for an SPPRC labelling algorithm stores its resident vertex, its predecessor arc over
+ * which it has been extended, its predecessor label, and its current vector of resource values. The 
+ * @class
+ */
+Graph.Label = function() {
+  this.arcIds = [];
+
+  this.parentId = null;
+
+  //just save both ids (a little reduntant) for easy access and serialization 
+//  this.arcId = arc.id; //incoming arc
+  this.nodeId = null; //= arc.end.id; //this label is resident (==ending) at node node
+//  this.id = (parent ? (parent.id + "->") : "" ) + this.nodeId; //that.nodeLabel(Graph.instance.nodes.get(this.nodeId));
+
+  this.resources = [0,0];
+  this.wait = null;
+
+  this.id = idOf(Graph.Label.labelIds++);
+
+  Graph.Label.labels.set(this.id,this);
+}
+
+Graph.Label.reset = function(){
+  Graph.Label.labelIds = 0; //assign unique ids to labels
+  Graph.Label.labels = d3.map(); //assign unique ids to labels
+}
+
+Graph.Label.reset();
+
+Graph.Label.getState = function(){
+  var state = { labelIds : Graph.Label.labelIds, keys : Graph.Label.labels.keys() };
+  return state;
+}
+//https://github.com/d3/d3/wiki/Arrays#d3_map
+Graph.Label.setState = function(state){
+  
+  Graph.Label.labelIds = state.labelIds;
+  
+  var keysCurrent = Graph.Label.labels.keys();
+  for(var i=0; i<keysCurrent.length; i++){
+    var k = keysCurrent[i];
+    if(state.keys.indexOf(k)<0){
+      Graph.Label.labels.remove(k); //label did not yet exist, remove it
+    }
+  }
+}
+
+// Graph.Label.remove = function(labelId){
+//   if(s.U.indexOf(labelId)){
+//     s.U.splice(labelId);
+//   }
+//   //return Graph.Label.labels.remove(labelId);
+// }
+
+
+Graph.Label.get = function(labelId){
+  return Graph.Label.labels.get(labelId);
+}
+
+Graph.Label.prototype.edgeIdChain = function(){
+  return this.arcIds.join("->")
+}
+
+Graph.Label.prototype.nodeIdChain = function(){
+  return this.arcIds.map(function(arcId){
+    return Graph.instance.edges.get(arcId).end.id;
+  }).join("->");
+}
+
+Graph.Label.prototype.isCheaper = function(other){
+  return this.resources[MINIMIZED_RESOURCE_INDEX] < other.resources[MINIMIZED_RESOURCE_INDEX];
+}
+
+Graph.Label.prototype.cost = function(){
+  return this.resources[MINIMIZED_RESOURCE_INDEX];
+}
+
+Graph.Label.prototype.time = function(){
+  return this.resources[CONSTRAINED_RESOURCE_INDEX];
+}
+
+Graph.Label.prototype.toString = function(full){
+  return this.id+(full ? "("+this.parentId+","+this.nodeId+")" : "");
+}
+
+//static method, not instance, so that we can serialize more easily
+Graph.Label.toString = function(label) {
+    return label.id /*+" edges:" +label.edgeIdChain() + */+" with resource consumption ("+ label.resources.map(function(d,i){
+        return "<span style=color:" + ((i==CONSTRAINED_RESOURCE_INDEX) ? "black" : "magenta") + ">"+d+"</span>";
+    }).join(",")+")";
+}
+
+/**
+ * Checks weather a label fulfills all its resource constraints in its resident node
+ * @param{Label} label
+ */
+Graph.Label.feasible = function(label) {
+    // var residentVertex = label.edges.get(label.arcId).end;
+    var residentVertex =  Graph.instance.nodes.get(label.nodeId);
+    if(label.resources[CONSTRAINED_RESOURCE_INDEX]<=residentVertex.resources[1]){ // timewindow [resources[0],resources[1]]; cost is unconstrained
+        if(label.resources[CONSTRAINED_RESOURCE_INDEX]>=residentVertex.resources[0]){ //nothing to do
+//                console.log2("waiting time of "+diff+" at "+label.nodeId);
+        }else{
+           label.wait = residentVertex.resources[0] - label.resources[CONSTRAINED_RESOURCE_INDEX]; //saved so we can draw a nice path
+           //logger.log3("waiting time of "+residentVertex.resources[0]+"-"+label.resources[CONSTRAINED_RESOURCE_INDEX]+"="+label.wait+" at "+label.nodeId);
+           label.resources[CONSTRAINED_RESOURCE_INDEX]=residentVertex.resources[0];
+        }
+        return true;
+    }else{
+        return false;
+    }
+}
+
+/**
+ * Static factory function
+ * extends a label along the arc and returns a new label
+ *
+ * @param{Label} label
+ * @return Label
+ */
+Graph.Label.extend = function(parent, arc) { //arc is an actual Graph.Edge or a fake trivial path {id:-1, end:source}
+  var label = new Graph.Label();
+
+  label.arcIds = parent.arcIds.concat([arc.id]);
+  label.parentId = parent.id;
+  label.nodeId = arc.end.id;
+  
+  //accumulate resources
+  for (var i = 0; i < parent.resources.length; i++) {
+    label.resources[i] = arc.resources[i]+parent.resources[i]; //TODO changes to min(r(w),e+l_parent) later
+  };
+
+  return label;
+}
+
+Graph.Label.trivial = function(sourceId){
+  var source = Graph.instance.nodes.get(sourceId);
+
+  var label = new Graph.Label();
+  label.resources[CONSTRAINED_RESOURCE_INDEX] = source.resources[0]; //[0] is lower, [1] is upper limit on constrained resource
+  label.nodeId = sourceId;
+
+  return label;
+}
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.4.3 on Fri Dec 30 2016 16:31:49 GMT+0100 (CET) +
+ + + + + diff --git a/implementation-doc/spp-rc-label-setting_js_LabelDrawer.js.html b/implementation-doc/spp-rc-label-setting_js_LabelDrawer.js.html new file mode 100644 index 0000000..184d896 --- /dev/null +++ b/implementation-doc/spp-rc-label-setting_js_LabelDrawer.js.html @@ -0,0 +1,414 @@ + + + + + JSDoc: Source: spp-rc-label-setting/js/LabelDrawer.js + + + + + + + + + + +
+ +

Source: spp-rc-label-setting/js/LabelDrawer.js

+ + + + + + +
+
+
/**
+ * @classdesc
+ * Secondary visualization layer to draw labels
+ * @constructor
+ */
+var LabelDrawer = function(svgOrigin,algo){
+
+    /////////////////
+    //PRIVATE
+
+    var leftMargin = 10;
+
+
+    var xRange = +svgOrigin.attr("width") || 400;
+        yRange = +svgOrigin.attr("height") || 300;
+    var wS = global_NodeLayout['borderWidth'];
+    var margin = {top: global_KnotenRadius+wS, right: global_KnotenRadius+wS, bottom: global_KnotenRadius+2*wS, left: global_KnotenRadius+leftMargin},
+        width = xRange - margin.left - margin.right,
+        height = yRange - margin.top - margin.bottom;
+
+    this.margin = margin;
+
+    var radius = global_KnotenRadius;//20;
+
+    svgOrigin
+        .attr({version: '1.1' , xmlns:"http://www.w3.org/2000/svg"})
+        .attr("width", width + margin.left + margin.right)
+        .attr("height", height + margin.top + margin.bottom)
+
+    var svg = svgOrigin.append("g")
+        .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+
+    var svg_timewindow=svg.append("rect").attr("class", "timewindow");
+    var svg_labels=svg.append("g").attr("id", "labels");
+
+
+    var x = d3.scale.linear()
+        .range([margin.left, width-margin.right]);
+
+    var y = d3.scale.linear()
+        .range([height-margin.top, margin.bottom]);
+
+        x.domain([0,10]);
+        y.domain([0,10]);
+
+    //Axis
+      var xAxis = d3.svg.axis().scale(x).orient("bottom");
+      var yAxis = d3.svg.axis().scale(y).orient("left");
+
+      svg.append("g")
+          .attr("class", "x axis")
+          .attr("transform", "translate(0," + height + ")")
+          .call(xAxis)
+        .append("text")
+          .attr("class", "label")
+          .attr("x", width)
+          .attr("y", 0)
+          .style("text-anchor", "end")
+          .text("time");
+
+      svg.append("g")
+          .attr("class", "y axis")
+          .attr("transform", "translate(10,0)")
+          .call(yAxis)
+        .append("text")
+          .attr("class", "label")
+//           .attr("transform", "rotate(-90)")
+          //.attr("x",10)
+          //.attr("y", -3)
+          .attr("dy", ".71em")
+          .style("text-anchor", "end")
+          .style("fill","magenta")
+          .text("cost")
+
+    var transform = function(d){
+      return "translate(" + x(d.x) + "," + y(d.y) + ")"
+    ;};
+
+    /////////////////
+    //PRIVILEDGED
+
+    this.reset = function(){
+    }
+
+    this.clear = function(){
+        svg_labels.selectAll("g").remove();
+    };
+
+    this.type="LabelDrawer";
+    this.graph = Graph.instance;
+    this.svgOrigin = svgOrigin;
+
+    var that = this
+
+    var labelEndTransform = function(d){
+        var d = d || {resources:[0,0]};
+        return "translate("+x(d.resources[0])+","+y(d.resources[1])+")";
+    }
+
+    var generatePathCoordinatesFromLabel = function(d,repeatParentAtEnd){
+        var pathinfo = [];
+        var current=d;
+        var i=5;
+        do{
+            pathinfo.push(current.resources);
+            if(current.wait){
+                pathinfo.push([current.resources[0]-current.wait,current.resources[1]]);
+            }
+        }
+        while((current=Graph.Label.get(current.parentId)) && i--);
+        pathinfo.reverse();
+        if(repeatParentAtEnd && pathinfo.length>=2){
+          pathinfo[pathinfo.length-1]=pathinfo[pathinfo.length-2];
+        }
+        return pathinfo;//.reverse();
+    }
+
+    var lineFunction = d3.svg.line()
+                         .x(function(d) { return x(d[0]); })
+                         .y(function(d) { return y(d[1]); })
+                         .interpolate("linear");//basis");
+
+    this.updateLabels = function(s,userChoseFilter){
+
+       if(!userChoseFilter){
+        if(s.id==STATUS_PATH_EXTEND_FEASIBLE || s.id==STATUS_PATH_EXTEND_UNFEASIBLE){
+          algo.setResidentNodeFilter(Graph.Label.get(s.l_dashId).nodeId,true);
+        }else if(s.currentNodeIdDominance != null && (s.id==STATUS_DOMINANCE || s.id==STATUS_DOMINANCE_NODE)){
+          algo.setResidentNodeFilter(s.currentNodeIdDominance,true);
+        }else{
+          algo.setResidentNodeFilter("all",true);
+        }
+       }
+
+
+        //var labels = s.U.concat(s.P)
+        //if(s.currentLabel) labels.push(s.currentLabel);
+        //if(s.l_dash) labels.push(s.l_dash);
+        
+        var labels = [];//Graph.Label.labels.values();
+          if(s.lId){
+            labels.push(Graph.Label.get(s.lId));
+          }
+          if(s.l_dashId){
+            labels.push(Graph.Label.get(s.l_dashId));
+          }
+          for(var i=0; i<s.U.length; i++){
+            labels.push(Graph.Label.get(s.U[i]));
+          }
+          for(var i=0; i<s.P.length; i++){
+            labels.push(Graph.Label.get(s.P[i]));
+          }
+
+        if(s.residentNodeFilterId != "all"){
+
+            labels = labels.filter(function(d){
+              return d.nodeId == s.residentNodeFilterId;
+            })
+        }
+
+
+//         console.log(labels);
+//         console.log(s.U,s.lId,s.P);
+
+         x.domain([0,Math.max(d3.max(labels, function(d) { return d.resources[0];})||0,10)]);
+         y.domain([0,Math.max(d3.max(labels, function(d) { return d.resources[1];})||0,10)]);
+
+//         var xAxis = d3.svg.axis().scale(x).orient("bottom");
+//         var yAxis = d3.svg.axis().scale(y).orient("left");
+        var t = svg.transition();//.duration(750);
+        t.select("g.y.axis").call(yAxis);
+        t.select("g.x.axis").call(xAxis);
+
+
+        this.updateTimeWindow(s);
+
+
+        // DATA JOIN
+        // Join new data with old elements, if any.
+          var selection = svg_labels.selectAll(".label")
+            .data(labels,function(d){return d.id});
+
+
+
+
+        // ENTER
+        // Create new elements as needed.
+          var enterSelection = 
+          selection.enter().append("g")
+            .attr("class","label unselectable");
+
+
+        enterSelection
+            .attr("opacity","1e-6")
+            .transition().duration(500)
+            .attr("opacity","1");
+
+         var enterSelectionLabelPath = enterSelection.append("path")
+            .attr("class","labelpath") //is not transformed
+            .style("stroke", "gray")
+            .style("fill","none")
+          
+          var enterSelectionLabelEnd = enterSelection.append("g")
+              .attr("class","labelend")
+              .style("cursor","pointer")
+              .on("click", function(d) {
+                    algo.setHighlightPathForLabel(d.id,false,true);
+                    console.log(d);
+                    //highlight path for this label
+              })
+
+
+           enterSelectionLabelEnd
+                .append("rect")
+                .attr({"rx":50, "ry":5, "height":20, "y":-10})
+                .style({"fill":"red", "stroke-width":2});// , "fill-opacity":1});
+
+           enterSelectionLabelEnd
+                .append("text")
+                .style("text-anchor", "middle")
+                .attr("dominant-baseline","middle")
+                .text(function(d){return d.id});
+
+//             .append("path")
+//                 .attr("d",shapeFun)
+//                 .attr("fill",labelColor2)
+            //.attr("r", 10)
+        //     .on("mouseenter",function(d){
+        //       var label = d;
+        //       while(label && label.arc){
+        //         label.arc.highlight=true;
+        //         label=label.parent;
+        //       }
+        //       updateEdges()
+        //       console.log(d);
+        //     })
+        //     .on("mouseleave",function(d){
+        //       var label = d;
+        //       while(label && label.arc){
+        //         label.arc.highlight=false;
+        //         label=label.parent;
+        //       }
+        //       updateEdges()
+        //       console.log(d);
+        //     })
+
+
+       // selection.enter().selectAll(".labelend")
+
+
+
+
+        // ENTER + UPDATE
+
+
+        // Appending to the enter selection expands the update selection to include
+        // entering elements; so, operations on the update selection after appending to
+        // the enter selection will apply to both entering and updating nodes.
+
+        selection.selectAll(".labelend")
+            .attr("transform",function(d){
+              return labelEndTransform(d.id == s.l_dashId ? Graph.Label.get(d.parentId) : d)
+              })// start at parent position and transition to new position
+            .transition().duration(500)
+            .attr("transform",labelEndTransform)
+
+        selection.selectAll("path")
+            .style("stroke-width",function(d){return d.id==s.highlightPathForLabelId ? 4 : 2;})
+            .style("stroke-dasharray",function(d){
+              return (d.id == algo.getState().l_dashId) ? "5,5" : "0";
+            })
+            .style("stroke",function(d){
+              if(d.id == s.l_dashId) return "orange";
+              else if(d.id == s.lId) return "red";
+              else if(d.id == s.minCostLabelId) return "magenta";
+              return "gray"
+            })
+            .attr("d",function(d){
+                var coords = generatePathCoordinatesFromLabel(d,d.id == s.l_dashId);
+                return lineFunction(coords);
+            })
+            .transition().duration(500)
+            .attr("d",function(d){
+                var coords = generatePathCoordinatesFromLabel(d,false);
+                return lineFunction(coords);
+            })
+
+
+
+
+//             .transition()
+//             .style("stroke",function(d){
+//               if(d==algo.s.currentLabel){
+//                 return "red";
+//               }else{
+//                 return "black"
+//               } 
+//             })
+    //     .attr("opacity",function(d){
+    //       return (d==algo.s.currentLabel || d.nodeId == currentNode || currentArc && currentArc.end==currentLabel.node) ? 1 : 0;
+    //     })
+
+
+        selection.selectAll(".labelend rect")
+            .attr("width",10)//function(d){return d.id.length*7})
+            .attr("x",-5)//function(d){return d.id.length*(-3.5)})
+            .style("fill",function(d){
+              //  if(s.id == algo.STATUS_DOMINANCE){
+              //     return algo.dominanceStepNodeColors(d.nodeId);
+              // }
+                if(d.id == s.minCostLabelId) return "magenta";
+                if(d.id == s.lId) return const_Colors.CurrentNodeColor;
+                if(d.id == s.l_dashId) return "orange";
+                if(s.U.some(function(a){return a==d.id})) return const_Colors.PQColor;
+                if(s.P.some(function(a){return a==d.id})) return const_Colors.FinishedNodeColor;
+            })
+            .style("stroke",function(d){
+              return "black";
+               // if(s.currentLabel && d.id==s.currentLabel.id) return const_Colors.NodeBorderHighlight;
+            })
+            .style("stroke-width",function(d){
+              return d.id == s.highlightPathForLabelId ? 2 : 0.5;
+            })
+
+
+
+        // EXIT
+        // Remove old elements as needed.
+         selection.exit()
+            .attr("opacity","1")
+            .transition().duration(500)
+            .attr("opacity","1e-6")
+            .remove();
+    
+    } //end updateNodes()
+
+
+    this.updateTimeWindow = function(s){
+      if(s.residentNodeFilterId == "all"){
+        svg_timewindow
+//             .attr("opacity","1")
+//             .transition().duration(500)
+            .attr("opacity",1e-6)
+      }else{
+        var residentNode = Graph.instance.nodes.get(s.residentNodeFilterId);
+        var yVals = y.range();
+        var xStart = x(residentNode.resources[0]);
+        var www = x(residentNode.resources[1])-xStart;
+        if(www<=0){
+          www=6;
+          xStart-=3;
+        }
+        svg_timewindow.attr({
+            x : xStart,
+            width : www,
+            y: yVals[1],
+            height : yVals[0]+margin.top,
+            opacity : 1
+        })
+      }
+    }
+
+} //end constructor GraphDrawer
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.4.3 on Fri Dec 30 2016 16:31:49 GMT+0100 (CET) +
+ + + + + diff --git a/implementation-doc/spp-rc-label-setting_js_SPPRCLabelSettingAlgorithm.js.html b/implementation-doc/spp-rc-label-setting_js_SPPRCLabelSettingAlgorithm.js.html new file mode 100644 index 0000000..ed574fe --- /dev/null +++ b/implementation-doc/spp-rc-label-setting_js_SPPRCLabelSettingAlgorithm.js.html @@ -0,0 +1,776 @@ + + + + + JSDoc: Source: spp-rc-label-setting/js/SPPRCLabelSettingAlgorithm.js + + + + + + + + + + +
+ +

Source: spp-rc-label-setting/js/SPPRCLabelSettingAlgorithm.js

+ + + + + + +
+
+
var STATUS_SELECTSOURCE = 0;
+var STATUS_START = 1;
+var STATUS_INIT = 2;
+var STATUS_MAINLOOP = 3;
+var STATUS_PATH_EXTEND = 4;
+var STATUS_PATH_EXTEND_FEASIBLE = 5;
+var STATUS_PATH_EXTEND_UNFEASIBLE = 6;
+var STATUS_LABEL_PROCESSED = 7;
+var STATUS_DOMINANCE = 8;
+var STATUS_DOMINANCE_NODE = 9;
+var STATUS_FINISHED = 10;
+
+/**
+ * SPPRC Label Setting Algorithm
+ * @author Adrian Haarbach
+ * @augments GraphDrawer
+ * @class
+ */
+function SPPRCLabelSettingAlgorithm(svgSelection,svgSelection2) {
+    GraphDrawer.call(this,svgSelection);
+
+    /**
+     * closure for this class
+     * @type SPPRCLabelSettingAlgorithm
+     */
+    var that = this;
+    
+    var debugConsole = false;
+    
+    /**
+     * the logger instance
+     * @type Logger
+     */
+    var logger = new Logger(d3.select("#logger"),d3.select("#loggerLastEntry"));
+
+
+    /**
+     * status variables
+     * @type Object
+     */
+    var s = null;
+
+    this.getState = function(){
+      return s;
+    }
+
+    var labelDrawer = new LabelDrawer(svgSelection2,this);
+
+    
+    var colormap = ["#a50026", "#d73027", "#f46d43", "#fdae61", "#fee08b", "#ffffbf", "#d9ef8b", "#a6d96a", "#66bd63", "#1a9850", "#006837"].reverse();
+
+    this.dominanceStepNodeColors = d3.scale.category10();
+    
+    this.nodeLabel = function(d) {
+        if (d.id == s.sourceId)
+            return "s";
+        else if(d.id == s.targetId)
+            return "t";
+        else
+            return d.id;
+    }
+
+    this.edgeHtml = function(d){
+      return "("+d.resources[0]+",<tspan style='fill:magenta'>"+d.resources[1]+"</tspan>)";
+    }
+
+    this.edgeStyle = function(d){
+      return "("+d.resources[0]+",<span style='color:magenta'>"+d.resources[1]+"</span>)";
+    }
+
+
+    ///////////
+    //SELECTBOXES
+
+    var highlightPathForLabelSelectBox = d3.select("#highlightPathForLabel");
+    highlightPathForLabelSelectBox.on('change',function(e){
+      that.setHighlightPathForLabel(this.value,false,true);
+    });
+    this.setHighlightPathForLabel = function(name,noUpdate,userChoseFilter){
+      s.highlightPathForLabelId = name;
+      highlightPathForLabelSelectBox.property("value",name); //does not trigger 'change' event
+      if(!noUpdate) that.update(userChoseFilter);
+    }
+
+    var residentNodeFilterSelectBox=d3.select("#filterLabelsByResidentNode");
+    residentNodeFilterSelectBox.on('change',function(e){
+      that.setResidentNodeFilter(this.value,false,true);
+    });
+    this.setResidentNodeFilter = function(name,noUpdate,userChoseFilter){
+      s.residentNodeFilterId = name;
+      residentNodeFilterSelectBox.property("value",name); //does not trigger 'change' event
+      if(!noUpdate) that.update(userChoseFilter);
+    }
+
+    ///////////
+
+
+    
+    this.onNodesEntered = function(selection) {
+        //select source and target nodes
+        selection
+        .style("cursor","pointer")
+        .on("click", function(d) {
+            if (s.id == STATUS_SELECTSOURCE) {
+                that.nextStepChoice(d);
+            }else{
+              that.setResidentNodeFilter(d.id,false,true);
+              console.log(d);
+              if(s.id == STATUS_FINISHED){
+                console.log("filter");
+                that.filter(d);
+              }
+              //highlight all labels which have this node as residentVertex
+            }
+        })
+    }
+    
+    this.onNodesUpdated = function(selection) {
+        selection
+        .selectAll("circle")
+        .style("fill", function(d) {
+            if (s.lId && (d.id == Graph.Label.get(s.lId).nodeId)) {
+                return const_Colors.NodeBorderHighlight;
+            } else if (d.id == s.sourceId){
+                return const_Colors.StartNodeColor;
+            }else if (d.id == s.targetId){
+                return "magenta";
+            }else{
+              return global_NodeLayout['fillStyle'];
+            }
+        })
+        //.style("stroke",function(d){return d.id==s.residentNodeFilterId ? "black" : global_NodeLayout['borderColor']})
+        .style("stroke-width",function(d){return d.id==s.residentNodeFilterId ? "4" : global_NodeLayout['borderWidth']});
+    }
+    
+    this.onEdgesEntered = function(selection) {
+    
+    }
+    
+    this.onEdgesUpdated = function(selection) {
+        //fat edges on complete path
+        var labelToHighlightPath = Graph.Label.get(s.highlightPathForLabelId);
+
+        //green edges on complete path
+        var minCostPath = Graph.Label.get(s.minCostLabelId);
+
+
+
+        selection.selectAll("line").each(function(d){
+            var attr = {"stroke":"black","stroke-width":global_Edgelayout['lineWidth']};
+            if(s.lId && (d.id == s.currentArcId)){
+//                 if(s.idPrev==STATUS_PUSH || s.idPrev==STATUS_ADMISSIBLEPUSH){
+                attr["stroke"]="orange";//const_Colors.CurrentNodeColor;
+               // attr["marker-end"]="url(#arrowhead2-red)";
+//                 }else{
+//                   attr["stroke"]="green";
+//                   attr["marker-end"]="url(#arrowhead2-green)";
+//                 }
+            }
+
+            if(labelToHighlightPath && labelToHighlightPath.arcIds.indexOf(d.id) >= 0){
+                attr["stroke-width"]=4;
+            }
+
+            if(minCostPath && minCostPath.arcIds.indexOf(d.id) >= 0){
+                attr["stroke"]='magenta';
+            }
+
+            d3.select(this).style(attr);
+           });
+    }
+
+
+    /**
+     * Replay Stack, speichert alle Schritte des Ablaufs für Zurück Button
+     * @type {Array}
+     */
+    var replayHistory = new Array();
+
+    /**
+     * Initialisiert das Zeichenfeld
+     * @method
+     */
+    this.init = function() {
+
+        Graph.addChangeListener(function(){
+            that.clear();
+            that.reset();
+            that.squeeze();
+            that.update();
+
+        });
+
+        this.reset();
+        this.update();
+    };
+
+    /**
+     * clear all states
+     */
+    this.reset = function(){
+        s = {
+            id: 0, //status id
+            idPrev: 0,
+            U: [], //unprocessed
+            P: [], //processed
+            lId: null, //current label
+            l_dashId: null, //current extended label. does not need to go into U or P afterwards
+            sourceId: -1,
+            mainLoopIt : 1,
+            currentResidentNodeEdgeIndex: -1, //for iteration outgoing edges in label extension step
+            currentArcId: null,
+            currentNodeIndexDominance: 0, //for iterating nodes in dominance step
+            currentNodeIdDominance: null, //for iterating nodes in dominance step
+            targetId : null, //only in filtering step for solution
+            minCostLabelId : null //only in filtering step for solution
+        };
+
+        setStatus(STATUS_SELECTSOURCE);
+
+        logger.reset();
+
+        s.highlightPathForLabelId=highlightPathForLabelSelectBox.property("value");
+        s.residentNodeFilterId=residentNodeFilterSelectBox.property("value");
+
+
+        if(Graph.instance){
+          labelDrawer.reset();
+
+          var arr = Graph.instance.getNodes().map(function(n){
+              return n.id;
+          });
+          arr.unshift("all");
+          var selection = residentNodeFilterSelectBox.selectAll('option').data(arr);
+          selection.enter().append('option');
+          selection
+            .attr('value',function(d){return d})
+            .text(function(d){return d});
+          selection.exit().remove();
+
+          this.nextStepChoice(Graph.instance.nodes.get(0),true);
+        }
+
+        Graph.Label.reset();
+
+
+        this.s=s;
+
+        this.replayHistory = [];
+    }
+
+    /**
+     * Makes the view consistent with the state
+     * @method
+     */
+    this.update = function(userChoseFilter){
+
+        var labelIds = [];//Graph.Label.labels.values();
+        if(s.lId){
+          labelIds.push(s.lId);
+        }
+        if(s.l_dashId){
+          labelIds.push(s.l_dashId);
+        }
+        for(var i=0; i<s.U.length; i++){
+          labelIds.push(s.U[i]);
+        }
+        for(var i=0; i<s.P.length; i++){
+          labelIds.push(s.P[i]);
+        }
+
+        this.updateDescriptionAndPseudocode(labelIds);
+        logger.update();
+
+        labelDrawer.updateLabels(s,userChoseFilter);
+
+        if(Graph.instance){
+             SPPRCLabelSettingAlgorithm.prototype.update.call(this); //updates the graph
+        }
+    }
+
+    /**
+     * When Tab comes into view
+     * @method
+     */
+    this.activate = function() {
+        this.reset();
+        this.squeeze();
+        this.update();
+    };
+
+    /**
+     * tab disappears from view
+     * @method
+     */
+    this.deactivate = function() {
+        this.stopFastForward();
+        this.replayHistory = [];
+    //         this.deregisterEventHandlers();
+    };
+    
+    
+    this.setDisabledBackward = function(disabled) {
+        $("#ta_button_Zurueck").button("option", "disabled", disabled);
+    };
+    
+    this.setDisabledForward = function(disabled, disabledSpulen) {
+        var disabledSpulen = (disabledSpulen!==undefined) ? disabledSpulen : disabled;
+        $("#ta_button_1Schritt").button("option", "disabled", disabled);
+        $("#ta_button_vorspulen").button("option", "disabled", disabledSpulen);
+    };
+
+    /**
+     * add a step to the replay stack, serialize stateful data
+     * @method
+     */
+    this.addReplayStep = function() {
+        
+        replayHistory.push({
+            "graphState": Graph.instance.getState(),
+            "labelState": Graph.Label.getState(),
+            "s": JSON.stringify(s),
+            "loggerState": logger.getState()
+        });
+        
+        if (debugConsole)
+            console.log("Current History Step: ", replayHistory[replayHistory.length - 1]);
+    
+    };
+
+    /**
+     * playback the last step from stack, deserialize stateful data
+     * @method
+     */
+    this.previousStepChoice = function() {
+        
+        var oldState = replayHistory.pop();
+        if (debugConsole)
+            console.log("Replay Step", oldState);
+        
+        Graph.instance.setState(oldState["graphState"]);
+        Graph.Label.setState(oldState["labelState"]);
+        s = JSON.parse(oldState["s"]);
+        logger.setState(oldState["loggerState"]);
+        
+        this.update();
+    };
+
+    /**
+     * updates status description and pseudocode highlight based on current s.id
+     * @method
+     */
+    this.updateDescriptionAndPseudocode = function(labelIds) {
+        var sel = d3.select("#ta_div_statusPseudocode").selectAll("div").selectAll("p")
+        sel.classed("marked", function(a, pInDivCounter, divCounter) {
+            return divCounter == s.idPrev;
+        });
+        
+        var sel = d3.select("#ta_div_statusErklaerung").selectAll("div");
+        sel.style("display", function(a, divCounter) {
+            return (divCounter == s.idPrev) ? "block" : "none";
+        });
+
+        d3.select("#ta_td_U").text("{"+s.U.join(",")+"}");
+        d3.select("#ta_td_l").text(s.lId ? s.lId : "-");
+        d3.select("#ta_td_P").text("{"+s.P.join(",")+"}");
+        d3.select("#ta_td_l_dash").text(s.l_dashId ? s.l_dashId : "-");
+
+        var selection = highlightPathForLabelSelectBox.selectAll('option').data(labelIds);
+           selection.enter().append('option');
+           selection
+            .attr('value',function(d){return d})
+            .text(function(d){return d});
+            selection.exit().remove();
+            
+//         if(Graph.instance){
+//           var nodes =Graph.instance.getNodes();
+//         console.log(nodes);
+//        // d3.select("#algoInformationen2").text(Graph.instance.getNodes().map(function(n){return n.id;}).join(","));
+//         var foo = d3.select("#algoInfo2H").data(nodes);
+//         foo.enter().append("th").text(function(d){return d.id});
+//         foo.selectAll("td").text("st");
+//         //foo.enter().append("td").text("st");
+//         //foo.selectAll("td").text(function(d){return d.state.endingPaths ? d.state.endingPaths.join(",") : ""});
+
+//         }
+
+
+        if(this.fastForwardIntervalID != null){
+            this.setDisabledForward(true,false);
+            this.setDisabledBackward(true);
+        }else if (s.id == STATUS_SELECTSOURCE) {
+            this.setDisabledBackward(true);
+            this.setDisabledForward(true);
+        } else if (s.idPrev == STATUS_FINISHED) {
+            this.setDisabledForward(true);
+            this.setDisabledBackward(false);
+        }else{
+            this.setDisabledForward(false);
+            this.setDisabledBackward(false);
+        }
+
+//         $("#ta_button_1Schritt").button("option", "disabled", true);
+//         $("#ta_button_Zurueck").button("option", "disabled", true);
+//         $("#ta_button_rewind").button("option", "disabled", true);
+
+
+    };
+
+
+    ///////////////////////
+    ///Actual algorithm steps
+
+
+    function setStatus(newStatus,oldStatus){
+      s.idPrev = (oldStatus != null) ? oldStatus : s.id;
+      s.id = newStatus;
+    }
+
+    /**
+     * Executes the next step in the algorithm
+     * @method
+     */
+    this.nextStepChoice = function(d) {
+        
+        if (debugConsole)
+            console.log("Current State: " + s.id);
+
+        // Speichere aktuellen Schritt im Stack
+        this.addReplayStep();
+        
+        switch (s.id) {
+            case STATUS_SELECTSOURCE:
+                this.selectSource(d);
+                break;
+            case STATUS_START: //TODO: is never called
+                logger.log("Now the algorithm can start");
+                setStatus(STATUS_INIT);
+                break;
+            case STATUS_INIT:
+                initLabels();
+                break;
+            case STATUS_MAINLOOP:
+                mainLoop();
+                break;
+            case STATUS_PATH_EXTEND:
+                pathExtend();
+                break;
+            case STATUS_PATH_EXTEND_FEASIBLE:
+            case STATUS_PATH_EXTEND_UNFEASIBLE:
+                pathExtendFeasible();
+                break;
+            case STATUS_LABEL_PROCESSED:
+                labelProcessed();
+                break;
+            case STATUS_DOMINANCE:
+                dominance();
+                break;
+            case STATUS_DOMINANCE_NODE:
+                dominanceNode();
+                break;
+            case STATUS_FINISHED:
+                this.filter();
+                this.stopFastForward();
+                break;
+            default:
+                console.log("Fehlerhafter State");
+                break;
+        }
+
+        //update view with status values
+        this.update();
+    };
+
+
+    /**
+     * select the source node
+     */
+    this.selectSource = function(d) {
+        s.sourceId = d.id;
+        this.setDisabledBackward(false);
+        setStatus(STATUS_INIT,STATUS_START);
+        logger.log("Picked s &larr; " + d.id + " as start node.");
+    };
+
+
+    /////////////
+    //following is generic label setting algorithm for SPPRC/ SPPTW
+     /**
+     * init the label queue / sets with the 
+     */
+    function initLabels() {
+
+        var label = Graph.Label.trivial(s.sourceId);
+        
+        s.U.push(label.id);
+        setStatus(STATUS_MAINLOOP);
+        
+        logger.log("Initialize: Add trivial label "+label.toString(true)+" to U");
+    }
+        
+    /**
+    * main loop: pops the current node from the queue until empty
+    */
+    function mainLoop() {
+        if (s.U.length == 0) {
+            setStatus(STATUS_FINISHED);
+            s.lId = null;
+            // that.stopFastForward();
+            logger.log("Finished");
+            that.nextStepChoice();
+            return;
+        }
+        
+        s.lId = s.U.shift();
+        s.currentResidentNodeEdgeIndex = 0;
+        logger.log("Main loop iteration " + (s.mainLoopIt++) + ": picked  l=" + Graph.Label.get(s.lId).toString(true)+ " from U");
+        
+        setStatus(STATUS_PATH_EXTEND);
+    }
+
+    /**
+     * try to extend currentLabel along currentArc
+     */
+    function pathExtend() {
+        var l = Graph.Label.get(s.lId);
+        var v = Graph.instance.nodes.get(l.nodeId);
+        
+        var outEdges = v.getOutEdges();
+        if(s.currentResidentNodeEdgeIndex >= outEdges.length){
+            setStatus(STATUS_LABEL_PROCESSED);
+            logger.log2("iterated all neighbours of "+v.id);
+        }else{
+            var arc = outEdges[s.currentResidentNodeEdgeIndex++];
+            s.currentArcId=arc.id;
+            var l_dash = Graph.Label.extend(l,arc); //TODO do we need the extended label already here?
+            //logger.log2("checking arc "+arc.toString(true,edgeResourceStyle)+" from "+v.toString(true,nodeResourceStyle));
+            logger.log2("Extend l="+l.toString()+" along e="+that.edgeStyle(arc)+" to get l'="+l_dash.toString());
+            s.l_dashId = l_dash.id;
+            if(Graph.Label.feasible(l_dash)){
+              setStatus(STATUS_PATH_EXTEND_FEASIBLE);
+            }else{
+              setStatus(STATUS_PATH_EXTEND_UNFEASIBLE);
+            }
+        }
+    }
+
+    /**
+     * Check if the previous label extension was feasible.
+     * if yes, put it in U, else discard it
+     */
+    function pathExtendFeasible() {
+        var l_dash = Graph.Label.get(s.l_dashId);
+        var w = Graph.instance.nodes.get(l_dash.nodeId);
+        s.currentArcId = null;
+
+        if(Graph.Label.feasible(l_dash)){
+            s.U.push(s.l_dashId);
+            if(!w.state.endingPaths) w.state.endingPaths = [];
+            w.state.endingPaths.push(s.l_dashId);
+            logger.log3("l'="+Graph.Label.toString(l_dash) + " feasible in w=" + w.toString(true) + ", add to U");
+        }else{
+            logger.log3("l'="+Graph.Label.toString(l_dash) + " infeasible in w=" + w.toString(true))
+        }
+        s.l_dashId = null;
+        setStatus(STATUS_PATH_EXTEND); // go back to inner FORALL loop head
+    }
+
+    /**
+     * put processed label in P
+     */
+    function labelProcessed() {
+        s.P.push(s.lId);
+        logger.log2("processed label " + Graph.Label.toString(Graph.Label.get(s.lId)) + ", added to P");
+        s.lId = null;
+        setStatus(STATUS_DOMINANCE);
+    }
+
+    /**
+     * discard strictly dominated labels in both P and U
+     */
+    function dominance() {
+        var nodes = Graph.instance.getNodes();
+        var node = null;
+        var text = "Dominance 1/2: ";
+        var skipped = [];
+
+        for(;s.currentNodeIndexDominance<nodes.length;s.currentNodeIndexDominance++){
+          node = nodes[s.currentNodeIndexDominance];
+          if(node.state.endingPaths && node.state.endingPaths.length>1){
+            break;
+          }else{
+            skipped.push(node.id);
+            node=null;
+          }
+        }
+//         do{
+//           node = nodes[s.currentNodeIndexDominance++];
+//           if(node && (!node.state.endingPaths || node.state.endingPaths.length<=1)){
+//             skip +=node.id+" ";
+//           }
+//         }while(s.currentNodeIndexDominance<nodes.length && (!node.state.endingPaths || node.state.endingPaths.length<=1));
+//         //logger.log2("not more than 1 path ending in resident node "+node.id););
+
+        var skip="";
+        if(skipped.length){
+          skip = "v="+skipped.join(",") +" skipped. ";
+        }
+
+        var end ="";
+
+        if(!node){//s.currentNodeIndexDominance >= nodes.length){
+            s.currentNodeIndexDominance=0;
+            s.currentNodeIdDominance=null;
+            end= "Checked all nodes.";
+            if (s.U.length == 0) {
+              setStatus(STATUS_FINISHED);
+              s.lId = null;
+              // that.stopFastForward();
+              //logger.log("Finished");
+              return;
+            }else{
+              setStatus(STATUS_MAINLOOP);
+            }
+        }else{
+          s.currentNodeIdDominance = node.id;
+          //labelDrawer.setResidentNodeFilter(s.currentNodeIdDominance,true,true);
+          setStatus(STATUS_DOMINANCE_NODE);
+          end = "Checking " + node.state.endingPaths.length + " paths ending in v="+node.id;
+        }
+
+        logger.log2(text + skip + end);
+    }
+
+    function dominanceNode(){
+        var node = Graph.instance.nodes.get(s.currentNodeIdDominance);
+        var dominated = [];
+        var removedLabels = [];
+        for(var j = 0; j < node.state.endingPaths.length; j++){
+            //remove all other paths in upper right cone of this
+            var path = Graph.Label.get(node.state.endingPaths[j]);
+            for(var k = 0; k < node.state.endingPaths.length; k++){
+                if(j==k) continue;
+                var otherpath = Graph.Label.get(node.state.endingPaths[k]);
+                if(!path || !otherpath || path == otherpath) continue;
+                if( path.resources.every(function(r,l){
+                    return r <= otherpath.resources[l]
+                    })){
+                    var removed = node.state.endingPaths.splice(k,1)[0];
+
+                    if(removed != otherpath.id){
+                        console.log("error");
+                    }
+                    dominated.push(Graph.Label.toString(otherpath) +" > " + Graph.Label.toString(path));
+                    removedLabels.push(otherpath.id);
+
+                    var indexInU = s.U.indexOf(removed);
+                    if(indexInU>=0) s.U.splice(indexInU,1);
+
+                    var indexInP = s.P.indexOf(removed);
+                    if(indexInP>=0) s.P.splice(indexInP,1);
+                }
+            }
+        }
+
+        var text = "Dominance 2/2: v="+node.id;
+
+        if(removedLabels.length>0){
+          logger.log3(text + " : "+removedLabels.join(",") +(removedLabels.length>1 ? " are" : " is") +" dominated.");
+        }else{
+          logger.log3(text + " : no dominated paths!");
+        }
+        
+        s.currentNodeIndexDominance++;
+
+        setStatus(STATUS_DOMINANCE);
+    }
+
+    /**
+     * discard strictly dominated labels in both P and U
+     */
+    this.filter = function(targetNode) {
+        if(!targetNode){
+          //pick node with highest label as t per default
+          targetNode = Graph.instance.nodes.get(Graph.instance.nodeIds-1);
+        }
+        setStatus(STATUS_FINISHED);
+
+        logger.log("filter solution step");
+        var labelIds = targetNode.state.endingPaths;
+        if(!labelIds) return;
+        var labels = labelIds.map(function(id){
+          return Graph.Label.get(id);
+        });
+
+        var minCostLabel = labels[0];
+
+        if(labels.length>1){
+          for(var i=1; i< labels.length; i++){
+            if(labels[i].isCheaper(minCostLabel)){
+              minCostLabel=labels[i];
+            }
+          }
+        }
+
+        s.targetId = targetNode.id;
+        s.minCostLabelId = minCostLabel.id;
+
+        logger.log("label with minimal cost ending in "+ targetNode.id + " is "+ minCostLabel.id + " with cost of "+minCostLabel.cost());
+        //this.setHighlightPathForLabel(minCostLabel.id,true,true);
+        this.setResidentNodeFilter(targetNode.id,false,true);
+    }
+
+    function nodeResourceStyle(d,i){
+        return "<span style=color:red>"+d+"</span>";
+    }
+
+    function edgeResourceStyle(d,i){
+        return "<span style=color:" + ((i==CONSTRAINED_RESOURCE_INDEX) ? "black" : "magenta") + ">"+d+"</span>";
+    }
+}
+
+// Vererbung realisieren
+SPPRCLabelSettingAlgorithm.prototype = Object.create(GraphDrawer.prototype);
+SPPRCLabelSettingAlgorithm.prototype.constructor = SPPRCLabelSettingAlgorithm;
+
+
+
+ + + + +
+ + + +
+ +
+ Documentation generated by JSDoc 3.4.3 on Fri Dec 30 2016 16:31:49 GMT+0100 (CET) +
+ + + + + diff --git a/implementation-doc/styles/jsdoc-default.css b/implementation-doc/styles/jsdoc-default.css new file mode 100644 index 0000000..ede1919 --- /dev/null +++ b/implementation-doc/styles/jsdoc-default.css @@ -0,0 +1,354 @@ +@font-face { + font-family: 'Open Sans'; + font-weight: normal; + font-style: normal; + src: url('../fonts/OpenSans-Regular-webfont.eot'); + src: + local('Open Sans'), + local('OpenSans'), + url('../fonts/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'), + url('../fonts/OpenSans-Regular-webfont.woff') format('woff'), + url('../fonts/OpenSans-Regular-webfont.svg#open_sansregular') format('svg'); +} + +@font-face { + font-family: 'Open Sans Light'; + font-weight: normal; + font-style: normal; + src: url('../fonts/OpenSans-Light-webfont.eot'); + src: + local('Open Sans Light'), + local('OpenSans Light'), + url('../fonts/OpenSans-Light-webfont.eot?#iefix') format('embedded-opentype'), + url('../fonts/OpenSans-Light-webfont.woff') format('woff'), + url('../fonts/OpenSans-Light-webfont.svg#open_sanslight') format('svg'); +} + +html +{ + overflow: auto; + background-color: #fff; + font-size: 14px; +} + +body +{ + font-family: 'Open Sans', sans-serif; + line-height: 1.5; + color: #4d4e53; + background-color: white; +} + +a, a:visited, a:active { + color: #0095dd; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +header +{ + display: block; + padding: 0px 4px; +} + +tt, code, kbd, samp { + font-family: Consolas, Monaco, 'Andale Mono', monospace; +} + +.class-description { + font-size: 130%; + line-height: 140%; + margin-bottom: 1em; + margin-top: 1em; +} + +.class-description:empty { + margin: 0; +} + +#main { + float: left; + width: 70%; +} + +article dl { + margin-bottom: 40px; +} + +section +{ + display: block; + background-color: #fff; + padding: 12px 24px; + border-bottom: 1px solid #ccc; + margin-right: 30px; +} + +.variation { + display: none; +} + +.signature-attributes { + font-size: 60%; + color: #aaa; + font-style: italic; + font-weight: lighter; +} + +nav +{ + display: block; + float: right; + margin-top: 28px; + width: 30%; + box-sizing: border-box; + border-left: 1px solid #ccc; + padding-left: 16px; +} + +nav ul { + font-family: 'Lucida Grande', 'Lucida Sans Unicode', arial, sans-serif; + font-size: 100%; + line-height: 17px; + padding: 0; + margin: 0; + list-style-type: none; +} + +nav ul a, nav ul a:visited, nav ul a:active { + font-family: Consolas, Monaco, 'Andale Mono', monospace; + line-height: 18px; + color: #4D4E53; +} + +nav h3 { + margin-top: 12px; +} + +nav li { + margin-top: 6px; +} + +footer { + display: block; + padding: 6px; + margin-top: 12px; + font-style: italic; + font-size: 90%; +} + +h1, h2, h3, h4 { + font-weight: 200; + margin: 0; +} + +h1 +{ + font-family: 'Open Sans Light', sans-serif; + font-size: 48px; + letter-spacing: -2px; + margin: 12px 24px 20px; +} + +h2, h3.subsection-title +{ + font-size: 30px; + font-weight: 700; + letter-spacing: -1px; + margin-bottom: 12px; +} + +h3 +{ + font-size: 24px; + letter-spacing: -0.5px; + margin-bottom: 12px; +} + +h4 +{ + font-size: 18px; + letter-spacing: -0.33px; + margin-bottom: 12px; + color: #4d4e53; +} + +h5, .container-overview .subsection-title +{ + font-size: 120%; + font-weight: bold; + letter-spacing: -0.01em; + margin: 8px 0 3px 0; +} + +h6 +{ + font-size: 100%; + letter-spacing: -0.01em; + margin: 6px 0 3px 0; + font-style: italic; +} + +table +{ + border-spacing: 0; + border: 0; + border-collapse: collapse; +} + +td, th +{ + border: 1px solid #ddd; + margin: 0px; + text-align: left; + vertical-align: top; + padding: 4px 6px; + display: table-cell; +} + +thead tr +{ + background-color: #ddd; + font-weight: bold; +} + +th { border-right: 1px solid #aaa; } +tr > th:last-child { border-right: 1px solid #ddd; } + +.ancestors { color: #999; } +.ancestors a +{ + color: #999 !important; + text-decoration: none; +} + +.clear +{ + clear: both; +} + +.important +{ + font-weight: bold; + color: #950B02; +} + +.yes-def { + text-indent: -1000px; +} + +.type-signature { + color: #aaa; +} + +.name, .signature { + font-family: Consolas, Monaco, 'Andale Mono', monospace; +} + +.details { margin-top: 14px; border-left: 2px solid #DDD; } +.details dt { width: 120px; float: left; padding-left: 10px; padding-top: 6px; } +.details dd { margin-left: 70px; } +.details ul { margin: 0; } +.details ul { list-style-type: none; } +.details li { margin-left: 30px; padding-top: 6px; } +.details pre.prettyprint { margin: 0 } +.details .object-value { padding-top: 0; } + +.description { + margin-bottom: 1em; + margin-top: 1em; +} + +.code-caption +{ + font-style: italic; + font-size: 107%; + margin: 0; +} + +.prettyprint +{ + border: 1px solid #ddd; + width: 80%; + overflow: auto; +} + +.prettyprint.source { + width: inherit; +} + +.prettyprint code +{ + font-size: 100%; + line-height: 18px; + display: block; + padding: 4px 12px; + margin: 0; + background-color: #fff; + color: #4D4E53; +} + +.prettyprint code span.line +{ + display: inline-block; +} + +.prettyprint.linenums +{ + padding-left: 70px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.prettyprint.linenums ol +{ + padding-left: 0; +} + +.prettyprint.linenums li +{ + border-left: 3px #ddd solid; +} + +.prettyprint.linenums li.selected, +.prettyprint.linenums li.selected * +{ + background-color: lightyellow; +} + +.prettyprint.linenums li * +{ + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; +} + +.params .name, .props .name, .name code { + color: #4D4E53; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 100%; +} + +.params td.description > p:first-child, +.props td.description > p:first-child +{ + margin-top: 0; + padding-top: 0; +} + +.params td.description > p:last-child, +.props td.description > p:last-child +{ + margin-bottom: 0; + padding-bottom: 0; +} + +.disabled { + color: #454545; +} diff --git a/implementation-doc/styles/prettify-jsdoc.css b/implementation-doc/styles/prettify-jsdoc.css new file mode 100644 index 0000000..5a2526e --- /dev/null +++ b/implementation-doc/styles/prettify-jsdoc.css @@ -0,0 +1,111 @@ +/* JSDoc prettify.js theme */ + +/* plain text */ +.pln { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* string content */ +.str { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a keyword */ +.kwd { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a comment */ +.com { + font-weight: normal; + font-style: italic; +} + +/* a type name */ +.typ { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a literal value */ +.lit { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* punctuation */ +.pun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp open bracket */ +.opn { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* lisp close bracket */ +.clo { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a markup tag name */ +.tag { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute name */ +.atn { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a markup attribute value */ +.atv { + color: #006400; + font-weight: normal; + font-style: normal; +} + +/* a declaration */ +.dec { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* a variable name */ +.var { + color: #000000; + font-weight: normal; + font-style: normal; +} + +/* a function name */ +.fun { + color: #000000; + font-weight: bold; + font-style: normal; +} + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; +} diff --git a/implementation-doc/styles/prettify-tomorrow.css b/implementation-doc/styles/prettify-tomorrow.css new file mode 100644 index 0000000..b6f92a7 --- /dev/null +++ b/implementation-doc/styles/prettify-tomorrow.css @@ -0,0 +1,132 @@ +/* Tomorrow Theme */ +/* Original theme - https://github.com/chriskempson/tomorrow-theme */ +/* Pretty printing styles. Used with prettify.js. */ +/* SPAN elements with the classes below are added by prettyprint. */ +/* plain text */ +.pln { + color: #4d4d4c; } + +@media screen { + /* string content */ + .str { + color: #718c00; } + + /* a keyword */ + .kwd { + color: #8959a8; } + + /* a comment */ + .com { + color: #8e908c; } + + /* a type name */ + .typ { + color: #4271ae; } + + /* a literal value */ + .lit { + color: #f5871f; } + + /* punctuation */ + .pun { + color: #4d4d4c; } + + /* lisp open bracket */ + .opn { + color: #4d4d4c; } + + /* lisp close bracket */ + .clo { + color: #4d4d4c; } + + /* a markup tag name */ + .tag { + color: #c82829; } + + /* a markup attribute name */ + .atn { + color: #f5871f; } + + /* a markup attribute value */ + .atv { + color: #3e999f; } + + /* a declaration */ + .dec { + color: #f5871f; } + + /* a variable name */ + .var { + color: #c82829; } + + /* a function name */ + .fun { + color: #4271ae; } } +/* Use higher contrast and text-weight for printable form. */ +@media print, projection { + .str { + color: #060; } + + .kwd { + color: #006; + font-weight: bold; } + + .com { + color: #600; + font-style: italic; } + + .typ { + color: #404; + font-weight: bold; } + + .lit { + color: #044; } + + .pun, .opn, .clo { + color: #440; } + + .tag { + color: #006; + font-weight: bold; } + + .atn { + color: #404; } + + .atv { + color: #060; } } +/* Style */ +/* +pre.prettyprint { + background: white; + font-family: Consolas, Monaco, 'Andale Mono', monospace; + font-size: 12px; + line-height: 1.5; + border: 1px solid #ccc; + padding: 10px; } +*/ + +/* Specify class=linenums on a pre to get line numbering */ +ol.linenums { + margin-top: 0; + margin-bottom: 0; } + +/* IE indents via margin-left */ +li.L0, +li.L1, +li.L2, +li.L3, +li.L4, +li.L5, +li.L6, +li.L7, +li.L8, +li.L9 { + /* */ } + +/* Alternate shading for lines */ +li.L1, +li.L3, +li.L5, +li.L7, +li.L9 { + /* */ } diff --git a/index.html b/index.html index 02c8b40..1c252d7 100644 --- a/index.html +++ b/index.html @@ -7,8 +7,9 @@

Visualization of advanced graph algorithms

push-relabel algorithm to solve the maximum flow problem
label-setting algorithm to solve the shortest path problem with resource constraints

An interdisciplinary research project (IDP) by Adrian Haarbach

final documentation | +inline documentation
final talk slides | -final talk abstract | +final talk abstract
github code repository
version 1.0
diff --git a/makedoc.sh b/makedoc.sh new file mode 100755 index 0000000..b39b681 --- /dev/null +++ b/makedoc.sh @@ -0,0 +1 @@ +jsdoc implementation/library-d3-svg/ implementation/maxflow-push-relabel/ implementation/spp-rc-label-setting/ -r -d implementation-doc \ No newline at end of file