diff --git a/README.md b/README.md index 633f732..f71910b 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@
-                       _     ____        _     
-  __ _ _ __ __ _ _ __ | |__ / ___| _   _| |__  
- / _` | '__/ _` | '_ \| '_ \\___ \| | | | '_ \ 
+                       _     ____        _
+  __ _ _ __ __ _ _ __ | |__ / ___| _   _| |__
+ / _` | '__/ _` | '_ \| '_ \\___ \| | | | '_ \
 | (_| | | | (_| | |_) | | | |___) | |_| | |_) |
- \__, |_|  \__,_| .__/|_| |_|____/ \__,_|_.__/ 
- |___/          |_|                            
+ \__, |_|  \__,_| .__/|_| |_|____/ \__,_|_.__/
+ |___/          |_|
 
-graphSub is a Javasctipt module for extracting +graphSub is a Javascript module for extracting a subset of a larger graph defined as per the force directed graph examples given in d3js. diff --git a/ramzaneh.html b/ramzaneh.html new file mode 100644 index 0000000..57c1beb --- /dev/null +++ b/ramzaneh.html @@ -0,0 +1,137 @@ + + + + + + + diff --git a/static/js/graphSub.js b/static/js/graphSub.js index 4058fa7..1fb93e3 100644 --- a/static/js/graphSub.js +++ b/static/js/graphSub.js @@ -52,7 +52,7 @@ var makeSubLinksArr = function(subNodes, propname, subLinks){ var graphSub = function(datum, propname, distanceToFetch, links, nodes){ console.log(arguments); // this function looks at the distance from the source nodes - // it expands outwards, distance times. this is equivelent + // it expands outwards, distance times. this is equivalent // to 'distance' in graph theory. // the algorithim here is concerned with collecting the links making up paths @@ -74,17 +74,17 @@ var graphSub = function(datum, propname, distanceToFetch, links, nodes){ current = toVisit.pop(toVisit); for (var i = 0; i < links.length; i++) { - + if(links[i].source[propname] === current){ // dont store if present, uses underscore.js union - subLinks = _.union([links[i]], subLinks); + subLinks = _.union([links[i]], subLinks); toVisit = _.union([links[i].target[propname]], toVisit); visited = _.union([links[i].target[propname]], visited); }; if(links[i].target[propname] === current){ // dont store if present, uses underscore.js union - subLinks = _.union([links[i]], subLinks); + subLinks = _.union([links[i]], subLinks); toVisit = _.union([links[i].source[propname]], toVisit); visited = _.union([links[i].source[propname]], visited); }; @@ -93,10 +93,10 @@ var graphSub = function(datum, propname, distanceToFetch, links, nodes){ count = count + 1; }; - console.log('i just vistited-> ', visited); + console.log('i just visited-> ', visited); result.nodes = makeSubNodesArr(visited, propname, nodes); result.links = makeSubLinksArr(result.nodes, propname, subLinks) console.log('final ', JSON.stringify(result)); return result; -}; \ No newline at end of file +}; diff --git a/static/tests/graphSubTests.html b/static/tests/graphSubTests.html index 75ef088..17aae7b 100644 --- a/static/tests/graphSubTests.html +++ b/static/tests/graphSubTests.html @@ -12,65 +12,65 @@ - \ No newline at end of file +