Skip to content

Commit

Permalink
finalized implementation-doc for 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
adrelino committed Dec 30, 2016
1 parent 68a72d1 commit ab31513
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 12 deletions.
2 changes: 0 additions & 2 deletions implementation/library-d3-svg/js/Graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ Graph.prototype.setState = function(savedState){
/**
* Style node or edge resources
* @static
* @param {[]} resources - sequentialized Graph
* @return {Graph} - parsed Graph object
*/
Graph.styleResources = function(resources,left,right,f){
var f = f || function(d){return d};
Expand Down
18 changes: 16 additions & 2 deletions implementation/library-d3-svg/js/GraphDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ function translate(x,y){
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){

Expand Down Expand Up @@ -359,17 +361,26 @@ GraphDrawer.prototype.update= function(){
}

/**
* Callback functions to be overwritten to style the graph
* 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")
}
Expand All @@ -396,11 +407,14 @@ GraphDrawer.prototype.nodeLabel = function(d){
}

/**
* Position of node
* 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;
};
Expand Down
7 changes: 0 additions & 7 deletions implementation/library-d3-svg/js/GraphEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,9 @@ var GraphEditor = function(svgOrigin){

/**
* Der aktuell ausgewählte Knoten
* @type d3 Selection with typeof datum() == Graph.Node
*/
var selectedNode = null;

/**
* Die aktuell ausgewählte Kante
* @type d3 Selection with typeof datum() == Graph.Edge
*/
// var selectedEdge = null;

/**
* line that is beeing drawn
*/
Expand Down
18 changes: 17 additions & 1 deletion implementation/maxflow-push-relabel/js/ResidualEdge.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
//http://stackoverflow.com/questions/7481988/multiple-constructor-in-javascript
/**
* @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;
Expand All @@ -9,10 +13,16 @@ Graph.ResidualEdge = function(idOrObj, 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) {
Expand All @@ -27,6 +37,9 @@ Graph.ResidualEdge.prototype.notnull = function(){
return c > 0;
}

/**
* The start vertex
*/
Graph.ResidualEdge.prototype.start = function(){
var edge = this.edge();
if(this.forward){
Expand All @@ -36,6 +49,9 @@ Graph.ResidualEdge.prototype.start = function(){
}
}

/**
* The end vertex
*/
Graph.ResidualEdge.prototype.end = function(){
var edge = this.edge();
if(this.forward){
Expand Down
5 changes: 5 additions & 0 deletions implementation/maxflow-push-relabel/js/ResidualGraphDrawer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @classdesc
* Secondary visualization layer to draw the residual graph
* @constructor
*/
var ResidualGraphDrawer = function(svgOrigin,algo){
var leftMargin = 10;
GraphDrawer.call(this,svgOrigin,{left:leftMargin});
Expand Down
5 changes: 5 additions & 0 deletions implementation/spp-rc-label-setting/js/LabelDrawer.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* @classdesc
* Secondary visualization layer to draw labels
* @constructor
*/
var LabelDrawer = function(svgOrigin,algo){

/////////////////
Expand Down

0 comments on commit ab31513

Please sign in to comment.