From 37fe2fd8e101a93dc8ae5d74d9d421637c6e4b4e Mon Sep 17 00:00:00 2001 From: Bruno Peixoto Date: Sun, 9 Jan 2022 16:50:18 -0300 Subject: [PATCH] Graph representation --- coverage/clover.xml | 390 +++++++++ coverage/coverage-final.json | 13 + .../depthFirstSearch.js.html | 289 +++++++ .../algorithms/depth-first-search/index.html | 116 +++ .../detect-cycle/detectDirectedCycle.js.html | 364 ++++++++ .../detectUndirectedCycle.js.html | 262 ++++++ ...ectUndirectedCycleUsingDisjointSet.js.html | 178 ++++ .../algorithms/detect-cycle/index.html | 146 ++++ coverage/lcov-report/base.css | 224 +++++ coverage/lcov-report/block-navigation.js | 87 ++ .../disjoint-set/DisjointSet.js.html | 376 +++++++++ .../disjoint-set/DisjointSetItem.js.html | 373 ++++++++ .../data-structures/disjoint-set/index.html | 131 +++ .../data-structures/graph/Graph.js.html | 673 +++++++++++++++ .../data-structures/graph/GraphEdge.js.html | 205 +++++ .../data-structures/graph/GraphVertex.js.html | 499 +++++++++++ .../data-structures/graph/index.html | 146 ++++ .../linked-list/LinkedList.js.html | 799 ++++++++++++++++++ .../linked-list/LinkedListNode.js.html | 115 +++ .../data-structures/linked-list/index.html | 131 +++ coverage/lcov-report/favicon.png | Bin 0 -> 540 bytes coverage/lcov-report/index.html | 191 +++++ coverage/lcov-report/prettify.css | 1 + coverage/lcov-report/prettify.js | 2 + coverage/lcov-report/sort-arrow-sprite.png | Bin 0 -> 209 bytes coverage/lcov-report/sorter.js | 196 +++++ .../utils/comparator/Comparator.js.html | 334 ++++++++ .../lcov-report/utils/comparator/index.html | 116 +++ coverage/lcov.info | 763 +++++++++++++++++ package.json | 1 - src/data-structures/graph/Graph.js | 3 +- src/server.js | 24 +- 32 files changed, 7133 insertions(+), 15 deletions(-) create mode 100644 coverage/clover.xml create mode 100644 coverage/coverage-final.json create mode 100644 coverage/lcov-report/algorithms/depth-first-search/depthFirstSearch.js.html create mode 100644 coverage/lcov-report/algorithms/depth-first-search/index.html create mode 100644 coverage/lcov-report/algorithms/detect-cycle/detectDirectedCycle.js.html create mode 100644 coverage/lcov-report/algorithms/detect-cycle/detectUndirectedCycle.js.html create mode 100644 coverage/lcov-report/algorithms/detect-cycle/detectUndirectedCycleUsingDisjointSet.js.html create mode 100644 coverage/lcov-report/algorithms/detect-cycle/index.html create mode 100644 coverage/lcov-report/base.css create mode 100644 coverage/lcov-report/block-navigation.js create mode 100644 coverage/lcov-report/data-structures/disjoint-set/DisjointSet.js.html create mode 100644 coverage/lcov-report/data-structures/disjoint-set/DisjointSetItem.js.html create mode 100644 coverage/lcov-report/data-structures/disjoint-set/index.html create mode 100644 coverage/lcov-report/data-structures/graph/Graph.js.html create mode 100644 coverage/lcov-report/data-structures/graph/GraphEdge.js.html create mode 100644 coverage/lcov-report/data-structures/graph/GraphVertex.js.html create mode 100644 coverage/lcov-report/data-structures/graph/index.html create mode 100644 coverage/lcov-report/data-structures/linked-list/LinkedList.js.html create mode 100644 coverage/lcov-report/data-structures/linked-list/LinkedListNode.js.html create mode 100644 coverage/lcov-report/data-structures/linked-list/index.html create mode 100644 coverage/lcov-report/favicon.png create mode 100644 coverage/lcov-report/index.html create mode 100644 coverage/lcov-report/prettify.css create mode 100644 coverage/lcov-report/prettify.js create mode 100644 coverage/lcov-report/sort-arrow-sprite.png create mode 100644 coverage/lcov-report/sorter.js create mode 100644 coverage/lcov-report/utils/comparator/Comparator.js.html create mode 100644 coverage/lcov-report/utils/comparator/index.html create mode 100644 coverage/lcov.info diff --git a/coverage/clover.xml b/coverage/clover.xml new file mode 100644 index 00000000..e0a16cde --- /dev/null +++ b/coverage/clover.xml @@ -0,0 +1,390 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/coverage/coverage-final.json b/coverage/coverage-final.json new file mode 100644 index 00000000..31ed040d --- /dev/null +++ b/coverage/coverage-final.json @@ -0,0 +1,13 @@ +{"/home/brunolnetto/github/path_finder/src/algorithms/depth-first-search/depthFirstSearch.js": {"path":"/home/brunolnetto/github/path_finder/src/algorithms/depth-first-search/depthFirstSearch.js","statementMap":{"0":{"start":{"line":18,"column":28},"end":{"line":18,"column":37}},"1":{"start":{"line":20,"column":23},"end":{"line":20,"column":31}},"2":{"start":{"line":22,"column":33},"end":{"line":33,"column":5}},"3":{"start":{"line":24,"column":19},"end":{"line":24,"column":21}},"4":{"start":{"line":25,"column":6},"end":{"line":31,"column":8}},"5":{"start":{"line":26,"column":8},"end":{"line":29,"column":9}},"6":{"start":{"line":27,"column":10},"end":{"line":27,"column":43}},"7":{"start":{"line":28,"column":10},"end":{"line":28,"column":22}},"8":{"start":{"line":30,"column":8},"end":{"line":30,"column":21}},"9":{"start":{"line":35,"column":2},"end":{"line":35,"column":88}},"10":{"start":{"line":36,"column":2},"end":{"line":36,"column":72}},"11":{"start":{"line":37,"column":2},"end":{"line":37,"column":72}},"12":{"start":{"line":39,"column":2},"end":{"line":39,"column":27}},"13":{"start":{"line":49,"column":2},"end":{"line":49,"column":59}},"14":{"start":{"line":51,"column":2},"end":{"line":55,"column":5}},"15":{"start":{"line":52,"column":4},"end":{"line":54,"column":5}},"16":{"start":{"line":53,"column":6},"end":{"line":53,"column":77}},"17":{"start":{"line":57,"column":2},"end":{"line":57,"column":59}},"18":{"start":{"line":66,"column":25},"end":{"line":66,"column":29}},"19":{"start":{"line":67,"column":2},"end":{"line":67,"column":90}}},"fnMap":{"0":{"name":"initCallbacks","decl":{"start":{"line":17,"column":9},"end":{"line":17,"column":22}},"loc":{"start":{"line":17,"column":39},"end":{"line":40,"column":1}},"line":17},"1":{"name":"(anonymous_1)","decl":{"start":{"line":20,"column":23},"end":{"line":20,"column":24}},"loc":{"start":{"line":20,"column":29},"end":{"line":20,"column":31}},"line":20},"2":{"name":"(anonymous_2)","decl":{"start":{"line":23,"column":4},"end":{"line":23,"column":5}},"loc":{"start":{"line":23,"column":10},"end":{"line":32,"column":5}},"line":23},"3":{"name":"(anonymous_3)","decl":{"start":{"line":25,"column":13},"end":{"line":25,"column":14}},"loc":{"start":{"line":25,"column":33},"end":{"line":31,"column":7}},"line":25},"4":{"name":"depthFirstSearchRecursive","decl":{"start":{"line":48,"column":9},"end":{"line":48,"column":34}},"loc":{"start":{"line":48,"column":84},"end":{"line":58,"column":1}},"line":48},"5":{"name":"(anonymous_5)","decl":{"start":{"line":51,"column":44},"end":{"line":51,"column":45}},"loc":{"start":{"line":51,"column":60},"end":{"line":55,"column":3}},"line":51},"6":{"name":"depthFirstSearch","decl":{"start":{"line":65,"column":24},"end":{"line":65,"column":40}},"loc":{"start":{"line":65,"column":72},"end":{"line":68,"column":1}},"line":65}},"branchMap":{"0":{"loc":{"start":{"line":17,"column":23},"end":{"line":17,"column":37}},"type":"default-arg","locations":[{"start":{"line":17,"column":35},"end":{"line":17,"column":37}}],"line":17},"1":{"loc":{"start":{"line":26,"column":8},"end":{"line":29,"column":9}},"type":"if","locations":[{"start":{"line":26,"column":8},"end":{"line":29,"column":9}},{"start":{},"end":{}}],"line":26},"2":{"loc":{"start":{"line":35,"column":37},"end":{"line":35,"column":87}},"type":"binary-expr","locations":[{"start":{"line":35,"column":37},"end":{"line":35,"column":61}},{"start":{"line":35,"column":65},"end":{"line":35,"column":87}}],"line":35},"3":{"loc":{"start":{"line":36,"column":34},"end":{"line":36,"column":71}},"type":"binary-expr","locations":[{"start":{"line":36,"column":34},"end":{"line":36,"column":55}},{"start":{"line":36,"column":59},"end":{"line":36,"column":71}}],"line":36},"4":{"loc":{"start":{"line":37,"column":34},"end":{"line":37,"column":71}},"type":"binary-expr","locations":[{"start":{"line":37,"column":34},"end":{"line":37,"column":55}},{"start":{"line":37,"column":59},"end":{"line":37,"column":71}}],"line":37},"5":{"loc":{"start":{"line":52,"column":4},"end":{"line":54,"column":5}},"type":"if","locations":[{"start":{"line":52,"column":4},"end":{"line":54,"column":5}},{"start":{},"end":{}}],"line":52}},"s":{"0":9,"1":9,"2":9,"3":9,"4":9,"5":16,"6":12,"7":12,"8":4,"9":9,"10":9,"11":9,"12":9,"13":47,"14":47,"15":63,"16":38,"17":47,"18":9,"19":9},"f":{"0":9,"1":27,"2":9,"3":16,"4":47,"5":63,"6":9},"b":{"0":[1],"1":[12,4],"2":[9,2],"3":[9,1],"4":[9,3],"5":[38,25]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"7488e9450a8b9e9b90f3ac97d47c94c05c7d4d20"} +,"/home/brunolnetto/github/path_finder/src/algorithms/detect-cycle/detectDirectedCycle.js": {"path":"/home/brunolnetto/github/path_finder/src/algorithms/detect-cycle/detectDirectedCycle.js","statementMap":{"0":{"start":{"line":9,"column":14},"end":{"line":9,"column":18}},"1":{"start":{"line":13,"column":23},"end":{"line":13,"column":25}},"2":{"start":{"line":16,"column":19},"end":{"line":16,"column":21}},"3":{"start":{"line":20,"column":18},"end":{"line":20,"column":20}},"4":{"start":{"line":24,"column":19},"end":{"line":24,"column":21}},"5":{"start":{"line":32,"column":2},"end":{"line":34,"column":5}},"6":{"start":{"line":33,"column":4},"end":{"line":33,"column":39}},"7":{"start":{"line":37,"column":20},"end":{"line":80,"column":3}},"8":{"start":{"line":39,"column":6},"end":{"line":61,"column":7}},"9":{"start":{"line":42,"column":8},"end":{"line":42,"column":19}},"10":{"start":{"line":44,"column":33},"end":{"line":44,"column":46}},"11":{"start":{"line":45,"column":34},"end":{"line":45,"column":48}},"12":{"start":{"line":47,"column":8},"end":{"line":51,"column":9}},"13":{"start":{"line":48,"column":10},"end":{"line":48,"column":67}},"14":{"start":{"line":49,"column":10},"end":{"line":49,"column":51}},"15":{"start":{"line":50,"column":10},"end":{"line":50,"column":75}},"16":{"start":{"line":53,"column":8},"end":{"line":53,"column":65}},"17":{"start":{"line":56,"column":8},"end":{"line":56,"column":56}},"18":{"start":{"line":57,"column":8},"end":{"line":57,"column":48}},"19":{"start":{"line":60,"column":8},"end":{"line":60,"column":62}},"20":{"start":{"line":66,"column":6},"end":{"line":66,"column":55}},"21":{"start":{"line":67,"column":6},"end":{"line":67,"column":45}},"22":{"start":{"line":72,"column":6},"end":{"line":74,"column":7}},"23":{"start":{"line":73,"column":8},"end":{"line":73,"column":21}},"24":{"start":{"line":78,"column":6},"end":{"line":78,"column":44}},"25":{"start":{"line":83,"column":2},"end":{"line":90,"column":3}},"26":{"start":{"line":85,"column":26},"end":{"line":85,"column":50}},"27":{"start":{"line":86,"column":24},"end":{"line":86,"column":47}},"28":{"start":{"line":89,"column":4},"end":{"line":89,"column":52}},"29":{"start":{"line":92,"column":2},"end":{"line":92,"column":15}}},"fnMap":{"0":{"name":"detectDirectedCycle","decl":{"start":{"line":8,"column":24},"end":{"line":8,"column":43}},"loc":{"start":{"line":8,"column":51},"end":{"line":93,"column":1}},"line":8},"1":{"name":"(anonymous_1)","decl":{"start":{"line":32,"column":33},"end":{"line":32,"column":34}},"loc":{"start":{"line":32,"column":45},"end":{"line":34,"column":3}},"line":32},"2":{"name":"(anonymous_2)","decl":{"start":{"line":38,"column":17},"end":{"line":38,"column":18}},"loc":{"start":{"line":38,"column":56},"end":{"line":62,"column":5}},"line":38},"3":{"name":"(anonymous_3)","decl":{"start":{"line":63,"column":17},"end":{"line":63,"column":18}},"loc":{"start":{"line":63,"column":40},"end":{"line":68,"column":5}},"line":63},"4":{"name":"(anonymous_4)","decl":{"start":{"line":69,"column":20},"end":{"line":69,"column":21}},"loc":{"start":{"line":69,"column":40},"end":{"line":79,"column":5}},"line":69}},"branchMap":{"0":{"loc":{"start":{"line":39,"column":6},"end":{"line":61,"column":7}},"type":"if","locations":[{"start":{"line":39,"column":6},"end":{"line":61,"column":7}},{"start":{"line":54,"column":13},"end":{"line":61,"column":7}}],"line":39},"1":{"loc":{"start":{"line":72,"column":6},"end":{"line":74,"column":7}},"type":"if","locations":[{"start":{"line":72,"column":6},"end":{"line":74,"column":7}},{"start":{},"end":{}}],"line":72}},"s":{"0":2,"1":2,"2":2,"3":2,"4":2,"5":2,"6":12,"7":2,"8":13,"9":1,"10":1,"11":1,"12":1,"13":2,"14":2,"15":2,"16":1,"17":12,"18":12,"19":12,"20":13,"21":13,"22":15,"23":2,"24":13,"25":2,"26":4,"27":4,"28":4,"29":2},"f":{"0":2,"1":12,"2":13,"3":13,"4":15},"b":{"0":[1,12],"1":[2,13]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"bcf67d2d2b0d11c8f78380781f9a051074f8c45f"} +,"/home/brunolnetto/github/path_finder/src/algorithms/detect-cycle/detectUndirectedCycle.js": {"path":"/home/brunolnetto/github/path_finder/src/algorithms/detect-cycle/detectUndirectedCycle.js","statementMap":{"0":{"start":{"line":9,"column":14},"end":{"line":9,"column":18}},"1":{"start":{"line":12,"column":26},"end":{"line":12,"column":28}},"2":{"start":{"line":15,"column":18},"end":{"line":15,"column":20}},"3":{"start":{"line":18,"column":20},"end":{"line":52,"column":3}},"4":{"start":{"line":21,"column":6},"end":{"line":23,"column":7}},"5":{"start":{"line":22,"column":8},"end":{"line":22,"column":21}},"6":{"start":{"line":26,"column":34},"end":{"line":26,"column":65}},"7":{"start":{"line":27,"column":37},"end":{"line":27,"column":94}},"8":{"start":{"line":29,"column":6},"end":{"line":29,"column":60}},"9":{"start":{"line":32,"column":6},"end":{"line":50,"column":7}},"10":{"start":{"line":34,"column":8},"end":{"line":34,"column":19}},"11":{"start":{"line":36,"column":33},"end":{"line":36,"column":46}},"12":{"start":{"line":37,"column":34},"end":{"line":37,"column":48}},"13":{"start":{"line":39,"column":8},"end":{"line":43,"column":9}},"14":{"start":{"line":40,"column":10},"end":{"line":40,"column":67}},"15":{"start":{"line":41,"column":10},"end":{"line":41,"column":51}},"16":{"start":{"line":42,"column":10},"end":{"line":42,"column":70}},"17":{"start":{"line":45,"column":8},"end":{"line":45,"column":65}},"18":{"start":{"line":48,"column":8},"end":{"line":48,"column":64}},"19":{"start":{"line":49,"column":8},"end":{"line":49,"column":57}},"20":{"start":{"line":55,"column":22},"end":{"line":55,"column":47}},"21":{"start":{"line":56,"column":2},"end":{"line":56,"column":50}},"22":{"start":{"line":58,"column":2},"end":{"line":58,"column":15}}},"fnMap":{"0":{"name":"detectUndirectedCycle","decl":{"start":{"line":8,"column":24},"end":{"line":8,"column":45}},"loc":{"start":{"line":8,"column":53},"end":{"line":59,"column":1}},"line":8},"1":{"name":"(anonymous_1)","decl":{"start":{"line":19,"column":20},"end":{"line":19,"column":21}},"loc":{"start":{"line":19,"column":55},"end":{"line":30,"column":5}},"line":19},"2":{"name":"(anonymous_2)","decl":{"start":{"line":31,"column":17},"end":{"line":31,"column":18}},"loc":{"start":{"line":31,"column":56},"end":{"line":51,"column":5}},"line":31}},"branchMap":{"0":{"loc":{"start":{"line":21,"column":6},"end":{"line":23,"column":7}},"type":"if","locations":[{"start":{"line":21,"column":6},"end":{"line":23,"column":7}},{"start":{},"end":{}}],"line":21},"1":{"loc":{"start":{"line":27,"column":37},"end":{"line":27,"column":94}},"type":"cond-expr","locations":[{"start":{"line":27,"column":59},"end":{"line":27,"column":87}},{"start":{"line":27,"column":90},"end":{"line":27,"column":94}}],"line":27},"2":{"loc":{"start":{"line":32,"column":6},"end":{"line":50,"column":7}},"type":"if","locations":[{"start":{"line":32,"column":6},"end":{"line":50,"column":7}},{"start":{"line":46,"column":13},"end":{"line":50,"column":7}}],"line":32}},"s":{"0":2,"1":2,"2":2,"3":2,"4":25,"5":6,"6":19,"7":19,"8":19,"9":13,"10":1,"11":1,"12":1,"13":1,"14":3,"15":3,"16":3,"17":1,"18":12,"19":12,"20":2,"21":2,"22":2},"f":{"0":2,"1":25,"2":13},"b":{"0":[6,19],"1":[15,4],"2":[1,12]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"2d39723d9eaa03b40526a64a14af80f031ce2ba5"} +,"/home/brunolnetto/github/path_finder/src/algorithms/detect-cycle/detectUndirectedCycleUsingDisjointSet.js": {"path":"/home/brunolnetto/github/path_finder/src/algorithms/detect-cycle/detectUndirectedCycleUsingDisjointSet.js","statementMap":{"0":{"start":{"line":11,"column":23},"end":{"line":11,"column":60}},"1":{"start":{"line":11,"column":40},"end":{"line":11,"column":60}},"2":{"start":{"line":12,"column":22},"end":{"line":12,"column":51}},"3":{"start":{"line":13,"column":2},"end":{"line":13,"column":84}},"4":{"start":{"line":13,"column":50},"end":{"line":13,"column":82}},"5":{"start":{"line":19,"column":19},"end":{"line":19,"column":24}},"6":{"start":{"line":21,"column":2},"end":{"line":28,"column":5}},"7":{"start":{"line":22,"column":4},"end":{"line":27,"column":5}},"8":{"start":{"line":24,"column":6},"end":{"line":24,"column":24}},"9":{"start":{"line":26,"column":6},"end":{"line":26,"column":68}},"10":{"start":{"line":30,"column":2},"end":{"line":30,"column":20}}},"fnMap":{"0":{"name":"detectUndirectedCycleUsingDisjointSet","decl":{"start":{"line":8,"column":24},"end":{"line":8,"column":61}},"loc":{"start":{"line":8,"column":69},"end":{"line":31,"column":1}},"line":8},"1":{"name":"(anonymous_1)","decl":{"start":{"line":11,"column":23},"end":{"line":11,"column":24}},"loc":{"start":{"line":11,"column":40},"end":{"line":11,"column":60}},"line":11},"2":{"name":"(anonymous_2)","decl":{"start":{"line":13,"column":33},"end":{"line":13,"column":34}},"loc":{"start":{"line":13,"column":50},"end":{"line":13,"column":82}},"line":13},"3":{"name":"(anonymous_3)","decl":{"start":{"line":21,"column":30},"end":{"line":21,"column":31}},"loc":{"start":{"line":21,"column":45},"end":{"line":28,"column":3}},"line":21}},"branchMap":{"0":{"loc":{"start":{"line":22,"column":4},"end":{"line":27,"column":5}},"type":"if","locations":[{"start":{"line":22,"column":4},"end":{"line":27,"column":5}},{"start":{"line":25,"column":11},"end":{"line":27,"column":5}}],"line":22}},"s":{"0":2,"1":118,"2":2,"3":2,"4":12,"5":2,"6":2,"7":11,"8":1,"9":10,"10":2},"f":{"0":2,"1":118,"2":12,"3":11},"b":{"0":[1,10]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"938b9a6c9d120bb7e960847ffe01e7cea14c523c"} +,"/home/brunolnetto/github/path_finder/src/data-structures/disjoint-set/DisjointSet.js": {"path":"/home/brunolnetto/github/path_finder/src/data-structures/disjoint-set/DisjointSet.js","statementMap":{"0":{"start":{"line":8,"column":4},"end":{"line":8,"column":35}},"1":{"start":{"line":9,"column":4},"end":{"line":9,"column":20}},"2":{"start":{"line":17,"column":28},"end":{"line":17,"column":76}},"3":{"start":{"line":19,"column":4},"end":{"line":22,"column":5}},"4":{"start":{"line":21,"column":6},"end":{"line":21,"column":61}},"5":{"start":{"line":24,"column":4},"end":{"line":24,"column":16}},"6":{"start":{"line":34,"column":33},"end":{"line":34,"column":81}},"7":{"start":{"line":37,"column":33},"end":{"line":37,"column":74}},"8":{"start":{"line":39,"column":4},"end":{"line":41,"column":5}},"9":{"start":{"line":40,"column":6},"end":{"line":40,"column":18}},"10":{"start":{"line":43,"column":4},"end":{"line":43,"column":51}},"11":{"start":{"line":54,"column":21},"end":{"line":54,"column":38}},"12":{"start":{"line":55,"column":21},"end":{"line":55,"column":38}},"13":{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},"14":{"start":{"line":58,"column":6},"end":{"line":58,"column":59}},"15":{"start":{"line":61,"column":4},"end":{"line":64,"column":5}},"16":{"start":{"line":63,"column":6},"end":{"line":63,"column":18}},"17":{"start":{"line":66,"column":18},"end":{"line":66,"column":38}},"18":{"start":{"line":67,"column":18},"end":{"line":67,"column":38}},"19":{"start":{"line":69,"column":4},"end":{"line":74,"column":5}},"20":{"start":{"line":71,"column":6},"end":{"line":71,"column":28}},"21":{"start":{"line":73,"column":6},"end":{"line":73,"column":18}},"22":{"start":{"line":77,"column":4},"end":{"line":77,"column":26}},"23":{"start":{"line":79,"column":4},"end":{"line":79,"column":16}},"24":{"start":{"line":88,"column":21},"end":{"line":88,"column":38}},"25":{"start":{"line":89,"column":21},"end":{"line":89,"column":38}},"26":{"start":{"line":91,"column":4},"end":{"line":93,"column":5}},"27":{"start":{"line":92,"column":6},"end":{"line":92,"column":59}},"28":{"start":{"line":95,"column":4},"end":{"line":95,"column":33}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":7,"column":2},"end":{"line":7,"column":3}},"loc":{"start":{"line":7,"column":27},"end":{"line":10,"column":3}},"line":7},"1":{"name":"(anonymous_1)","decl":{"start":{"line":16,"column":2},"end":{"line":16,"column":3}},"loc":{"start":{"line":16,"column":21},"end":{"line":25,"column":3}},"line":16},"2":{"name":"(anonymous_2)","decl":{"start":{"line":33,"column":2},"end":{"line":33,"column":3}},"loc":{"start":{"line":33,"column":18},"end":{"line":44,"column":3}},"line":33},"3":{"name":"(anonymous_3)","decl":{"start":{"line":53,"column":2},"end":{"line":53,"column":3}},"loc":{"start":{"line":53,"column":24},"end":{"line":80,"column":3}},"line":53},"4":{"name":"(anonymous_4)","decl":{"start":{"line":87,"column":2},"end":{"line":87,"column":3}},"loc":{"start":{"line":87,"column":28},"end":{"line":96,"column":3}},"line":87}},"branchMap":{"0":{"loc":{"start":{"line":19,"column":4},"end":{"line":22,"column":5}},"type":"if","locations":[{"start":{"line":19,"column":4},"end":{"line":22,"column":5}},{"start":{},"end":{}}],"line":19},"1":{"loc":{"start":{"line":39,"column":4},"end":{"line":41,"column":5}},"type":"if","locations":[{"start":{"line":39,"column":4},"end":{"line":41,"column":5}},{"start":{},"end":{}}],"line":39},"2":{"loc":{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},"type":"if","locations":[{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},{"start":{},"end":{}}],"line":57},"3":{"loc":{"start":{"line":57,"column":8},"end":{"line":57,"column":46}},"type":"binary-expr","locations":[{"start":{"line":57,"column":8},"end":{"line":57,"column":25}},{"start":{"line":57,"column":29},"end":{"line":57,"column":46}}],"line":57},"4":{"loc":{"start":{"line":61,"column":4},"end":{"line":64,"column":5}},"type":"if","locations":[{"start":{"line":61,"column":4},"end":{"line":64,"column":5}},{"start":{},"end":{}}],"line":61},"5":{"loc":{"start":{"line":69,"column":4},"end":{"line":74,"column":5}},"type":"if","locations":[{"start":{"line":69,"column":4},"end":{"line":74,"column":5}},{"start":{},"end":{}}],"line":69},"6":{"loc":{"start":{"line":91,"column":4},"end":{"line":93,"column":5}},"type":"if","locations":[{"start":{"line":91,"column":4},"end":{"line":93,"column":5}},{"start":{},"end":{}}],"line":91},"7":{"loc":{"start":{"line":91,"column":8},"end":{"line":91,"column":46}},"type":"binary-expr","locations":[{"start":{"line":91,"column":8},"end":{"line":91,"column":25}},{"start":{"line":91,"column":29},"end":{"line":91,"column":46}}],"line":91}},"s":{"0":7,"1":7,"2":26,"3":26,"4":26,"5":26,"6":128,"7":128,"8":128,"9":10,"10":118,"11":23,"12":23,"13":23,"14":1,"15":22,"16":1,"17":21,"18":21,"19":21,"20":1,"21":1,"22":20,"23":20,"24":29,"25":29,"26":29,"27":1,"28":28},"f":{"0":7,"1":26,"2":128,"3":23,"4":29},"b":{"0":[26,0],"1":[10,118],"2":[1,22],"3":[23,22],"4":[1,21],"5":[1,20],"6":[1,28],"7":[29,28]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"30c8407e87a49ae0dc8ac0413b6b21eb7f76b0e0"} +,"/home/brunolnetto/github/path_finder/src/data-structures/disjoint-set/DisjointSetItem.js": {"path":"/home/brunolnetto/github/path_finder/src/data-structures/disjoint-set/DisjointSetItem.js","statementMap":{"0":{"start":{"line":7,"column":4},"end":{"line":7,"column":23}},"1":{"start":{"line":8,"column":4},"end":{"line":8,"column":35}},"2":{"start":{"line":10,"column":4},"end":{"line":10,"column":23}},"3":{"start":{"line":11,"column":4},"end":{"line":11,"column":23}},"4":{"start":{"line":19,"column":4},"end":{"line":21,"column":5}},"5":{"start":{"line":20,"column":6},"end":{"line":20,"column":42}},"6":{"start":{"line":24,"column":4},"end":{"line":24,"column":22}},"7":{"start":{"line":31,"column":4},"end":{"line":31,"column":56}},"8":{"start":{"line":38,"column":4},"end":{"line":38,"column":32}},"9":{"start":{"line":47,"column":4},"end":{"line":49,"column":5}},"10":{"start":{"line":48,"column":6},"end":{"line":48,"column":15}},"11":{"start":{"line":51,"column":15},"end":{"line":51,"column":16}},"12":{"start":{"line":54,"column":4},"end":{"line":60,"column":7}},"13":{"start":{"line":56,"column":6},"end":{"line":56,"column":16}},"14":{"start":{"line":59,"column":6},"end":{"line":59,"column":30}},"15":{"start":{"line":62,"column":4},"end":{"line":62,"column":16}},"16":{"start":{"line":69,"column":4},"end":{"line":69,"column":40}},"17":{"start":{"line":78,"column":4},"end":{"line":78,"column":29}},"18":{"start":{"line":79,"column":4},"end":{"line":81,"column":5}},"19":{"start":{"line":80,"column":6},"end":{"line":80,"column":32}},"20":{"start":{"line":83,"column":4},"end":{"line":83,"column":16}},"21":{"start":{"line":91,"column":4},"end":{"line":91,"column":50}},"22":{"start":{"line":92,"column":4},"end":{"line":92,"column":37}},"23":{"start":{"line":94,"column":4},"end":{"line":94,"column":16}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":6,"column":2},"end":{"line":6,"column":3}},"loc":{"start":{"line":6,"column":34},"end":{"line":12,"column":3}},"line":6},"1":{"name":"(anonymous_1)","decl":{"start":{"line":17,"column":2},"end":{"line":17,"column":3}},"loc":{"start":{"line":17,"column":11},"end":{"line":25,"column":3}},"line":17},"2":{"name":"(anonymous_2)","decl":{"start":{"line":30,"column":2},"end":{"line":30,"column":3}},"loc":{"start":{"line":30,"column":12},"end":{"line":32,"column":3}},"line":30},"3":{"name":"(anonymous_3)","decl":{"start":{"line":37,"column":2},"end":{"line":37,"column":3}},"loc":{"start":{"line":37,"column":11},"end":{"line":39,"column":3}},"line":37},"4":{"name":"(anonymous_4)","decl":{"start":{"line":46,"column":2},"end":{"line":46,"column":3}},"loc":{"start":{"line":46,"column":12},"end":{"line":63,"column":3}},"line":46},"5":{"name":"(anonymous_5)","decl":{"start":{"line":54,"column":31},"end":{"line":54,"column":32}},"loc":{"start":{"line":54,"column":42},"end":{"line":60,"column":5}},"line":54},"6":{"name":"(anonymous_6)","decl":{"start":{"line":68,"column":2},"end":{"line":68,"column":3}},"loc":{"start":{"line":68,"column":16},"end":{"line":70,"column":3}},"line":68},"7":{"name":"(anonymous_7)","decl":{"start":{"line":77,"column":2},"end":{"line":77,"column":3}},"loc":{"start":{"line":77,"column":56},"end":{"line":84,"column":3}},"line":77},"8":{"name":"(anonymous_8)","decl":{"start":{"line":90,"column":2},"end":{"line":90,"column":3}},"loc":{"start":{"line":90,"column":22},"end":{"line":95,"column":3}},"line":90}},"branchMap":{"0":{"loc":{"start":{"line":19,"column":4},"end":{"line":21,"column":5}},"type":"if","locations":[{"start":{"line":19,"column":4},"end":{"line":21,"column":5}},{"start":{},"end":{}}],"line":19},"1":{"loc":{"start":{"line":31,"column":11},"end":{"line":31,"column":55}},"type":"cond-expr","locations":[{"start":{"line":31,"column":27},"end":{"line":31,"column":31}},{"start":{"line":31,"column":34},"end":{"line":31,"column":55}}],"line":31},"2":{"loc":{"start":{"line":47,"column":4},"end":{"line":49,"column":5}},"type":"if","locations":[{"start":{"line":47,"column":4},"end":{"line":49,"column":5}},{"start":{},"end":{}}],"line":47},"3":{"loc":{"start":{"line":77,"column":24},"end":{"line":77,"column":54}},"type":"default-arg","locations":[{"start":{"line":77,"column":50},"end":{"line":77,"column":54}}],"line":77},"4":{"loc":{"start":{"line":79,"column":4},"end":{"line":81,"column":5}},"type":"if","locations":[{"start":{"line":79,"column":4},"end":{"line":81,"column":5}},{"start":{},"end":{}}],"line":79}},"s":{"0":162,"1":162,"2":162,"3":162,"4":327,"5":185,"6":142,"7":177,"8":197,"9":105,"10":79,"11":26,"12":26,"13":47,"14":47,"15":26,"16":145,"17":29,"18":29,"19":2,"20":29,"21":27,"22":27,"23":27},"f":{"0":162,"1":327,"2":177,"3":197,"4":105,"5":47,"6":145,"7":29,"8":27},"b":{"0":[185,142],"1":[128,49],"2":[79,26],"3":[2],"4":[2,27]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"3c0390ec584e02749743838a788dc3352f234e8d"} +,"/home/brunolnetto/github/path_finder/src/data-structures/graph/Graph.js": {"path":"/home/brunolnetto/github/path_finder/src/data-structures/graph/Graph.js","statementMap":{"0":{"start":{"line":6,"column":4},"end":{"line":6,"column":23}},"1":{"start":{"line":7,"column":4},"end":{"line":7,"column":20}},"2":{"start":{"line":8,"column":4},"end":{"line":8,"column":33}},"3":{"start":{"line":16,"column":4},"end":{"line":16,"column":50}},"4":{"start":{"line":17,"column":4},"end":{"line":17,"column":15}},"5":{"start":{"line":25,"column":4},"end":{"line":25,"column":36}},"6":{"start":{"line":33,"column":4},"end":{"line":33,"column":33}},"7":{"start":{"line":40,"column":4},"end":{"line":40,"column":40}},"8":{"start":{"line":47,"column":4},"end":{"line":47,"column":37}},"9":{"start":{"line":56,"column":22},"end":{"line":56,"column":68}},"10":{"start":{"line":57,"column":20},"end":{"line":57,"column":64}},"11":{"start":{"line":60,"column":4},"end":{"line":63,"column":5}},"12":{"start":{"line":61,"column":6},"end":{"line":61,"column":39}},"13":{"start":{"line":62,"column":6},"end":{"line":62,"column":67}},"14":{"start":{"line":66,"column":4},"end":{"line":69,"column":5}},"15":{"start":{"line":67,"column":6},"end":{"line":67,"column":37}},"16":{"start":{"line":68,"column":6},"end":{"line":68,"column":63}},"17":{"start":{"line":72,"column":4},"end":{"line":76,"column":5}},"18":{"start":{"line":73,"column":6},"end":{"line":73,"column":60}},"19":{"start":{"line":75,"column":6},"end":{"line":75,"column":39}},"20":{"start":{"line":79,"column":4},"end":{"line":86,"column":5}},"21":{"start":{"line":81,"column":6},"end":{"line":81,"column":32}},"22":{"start":{"line":84,"column":6},"end":{"line":84,"column":32}},"23":{"start":{"line":85,"column":6},"end":{"line":85,"column":30}},"24":{"start":{"line":88,"column":4},"end":{"line":88,"column":16}},"25":{"start":{"line":96,"column":4},"end":{"line":100,"column":5}},"26":{"start":{"line":97,"column":6},"end":{"line":97,"column":39}},"27":{"start":{"line":99,"column":6},"end":{"line":99,"column":49}},"28":{"start":{"line":103,"column":24},"end":{"line":103,"column":70}},"29":{"start":{"line":104,"column":22},"end":{"line":104,"column":66}},"30":{"start":{"line":106,"column":4},"end":{"line":106,"column":33}},"31":{"start":{"line":107,"column":4},"end":{"line":107,"column":31}},"32":{"start":{"line":116,"column":19},"end":{"line":116,"column":60}},"33":{"start":{"line":118,"column":4},"end":{"line":120,"column":5}},"34":{"start":{"line":119,"column":6},"end":{"line":119,"column":18}},"35":{"start":{"line":122,"column":4},"end":{"line":122,"column":38}},"36":{"start":{"line":129,"column":4},"end":{"line":131,"column":10}},"37":{"start":{"line":130,"column":6},"end":{"line":130,"column":39}},"38":{"start":{"line":140,"column":4},"end":{"line":149,"column":7}},"39":{"start":{"line":142,"column":6},"end":{"line":142,"column":28}},"40":{"start":{"line":145,"column":6},"end":{"line":145,"column":21}},"41":{"start":{"line":148,"column":6},"end":{"line":148,"column":25}},"42":{"start":{"line":151,"column":4},"end":{"line":151,"column":16}},"43":{"start":{"line":158,"column":28},"end":{"line":158,"column":30}},"44":{"start":{"line":159,"column":4},"end":{"line":161,"column":7}},"45":{"start":{"line":160,"column":6},"end":{"line":160,"column":47}},"46":{"start":{"line":163,"column":4},"end":{"line":163,"column":27}},"47":{"start":{"line":170,"column":21},"end":{"line":170,"column":42}},"48":{"start":{"line":171,"column":28},"end":{"line":171,"column":53}},"49":{"start":{"line":175,"column":28},"end":{"line":177,"column":6}},"50":{"start":{"line":176,"column":6},"end":{"line":176,"column":51}},"51":{"start":{"line":180,"column":4},"end":{"line":185,"column":7}},"52":{"start":{"line":181,"column":6},"end":{"line":184,"column":9}},"53":{"start":{"line":182,"column":30},"end":{"line":182,"column":64}},"54":{"start":{"line":183,"column":8},"end":{"line":183,"column":93}},"55":{"start":{"line":187,"column":4},"end":{"line":187,"column":27}},"56":{"start":{"line":194,"column":4},"end":{"line":194,"column":49}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":5,"column":2},"end":{"line":5,"column":3}},"loc":{"start":{"line":5,"column":34},"end":{"line":9,"column":3}},"line":5},"1":{"name":"(anonymous_1)","decl":{"start":{"line":15,"column":2},"end":{"line":15,"column":3}},"loc":{"start":{"line":15,"column":23},"end":{"line":18,"column":3}},"line":15},"2":{"name":"(anonymous_2)","decl":{"start":{"line":24,"column":2},"end":{"line":24,"column":3}},"loc":{"start":{"line":24,"column":28},"end":{"line":26,"column":3}},"line":24},"3":{"name":"(anonymous_3)","decl":{"start":{"line":32,"column":2},"end":{"line":32,"column":3}},"loc":{"start":{"line":32,"column":23},"end":{"line":34,"column":3}},"line":32},"4":{"name":"(anonymous_4)","decl":{"start":{"line":39,"column":2},"end":{"line":39,"column":3}},"loc":{"start":{"line":39,"column":19},"end":{"line":41,"column":3}},"line":39},"5":{"name":"(anonymous_5)","decl":{"start":{"line":46,"column":2},"end":{"line":46,"column":3}},"loc":{"start":{"line":46,"column":16},"end":{"line":48,"column":3}},"line":46},"6":{"name":"(anonymous_6)","decl":{"start":{"line":54,"column":2},"end":{"line":54,"column":3}},"loc":{"start":{"line":54,"column":16},"end":{"line":89,"column":3}},"line":54},"7":{"name":"(anonymous_7)","decl":{"start":{"line":94,"column":2},"end":{"line":94,"column":3}},"loc":{"start":{"line":94,"column":19},"end":{"line":108,"column":3}},"line":94},"8":{"name":"(anonymous_8)","decl":{"start":{"line":115,"column":2},"end":{"line":115,"column":3}},"loc":{"start":{"line":115,"column":35},"end":{"line":123,"column":3}},"line":115},"9":{"name":"(anonymous_9)","decl":{"start":{"line":128,"column":2},"end":{"line":128,"column":3}},"loc":{"start":{"line":128,"column":14},"end":{"line":132,"column":3}},"line":128},"10":{"name":"(anonymous_10)","decl":{"start":{"line":129,"column":37},"end":{"line":129,"column":38}},"loc":{"start":{"line":129,"column":60},"end":{"line":131,"column":5}},"line":129},"11":{"name":"(anonymous_11)","decl":{"start":{"line":138,"column":2},"end":{"line":138,"column":3}},"loc":{"start":{"line":138,"column":12},"end":{"line":152,"column":3}},"line":138},"12":{"name":"(anonymous_12)","decl":{"start":{"line":140,"column":31},"end":{"line":140,"column":32}},"loc":{"start":{"line":140,"column":41},"end":{"line":149,"column":5}},"line":140},"13":{"name":"(anonymous_13)","decl":{"start":{"line":157,"column":2},"end":{"line":157,"column":3}},"loc":{"start":{"line":157,"column":23},"end":{"line":164,"column":3}},"line":157},"14":{"name":"(anonymous_14)","decl":{"start":{"line":159,"column":34},"end":{"line":159,"column":35}},"loc":{"start":{"line":159,"column":53},"end":{"line":161,"column":5}},"line":159},"15":{"name":"(anonymous_15)","decl":{"start":{"line":169,"column":2},"end":{"line":169,"column":3}},"loc":{"start":{"line":169,"column":23},"end":{"line":188,"column":3}},"line":169},"16":{"name":"(anonymous_16)","decl":{"start":{"line":175,"column":66},"end":{"line":175,"column":67}},"loc":{"start":{"line":175,"column":72},"end":{"line":177,"column":5}},"line":175},"17":{"name":"(anonymous_17)","decl":{"start":{"line":180,"column":21},"end":{"line":180,"column":22}},"loc":{"start":{"line":180,"column":46},"end":{"line":185,"column":5}},"line":180},"18":{"name":"(anonymous_18)","decl":{"start":{"line":181,"column":36},"end":{"line":181,"column":37}},"loc":{"start":{"line":181,"column":50},"end":{"line":184,"column":7}},"line":181},"19":{"name":"(anonymous_19)","decl":{"start":{"line":193,"column":2},"end":{"line":193,"column":3}},"loc":{"start":{"line":193,"column":13},"end":{"line":195,"column":3}},"line":193}},"branchMap":{"0":{"loc":{"start":{"line":5,"column":14},"end":{"line":5,"column":32}},"type":"default-arg","locations":[{"start":{"line":5,"column":27},"end":{"line":5,"column":32}}],"line":5},"1":{"loc":{"start":{"line":60,"column":4},"end":{"line":63,"column":5}},"type":"if","locations":[{"start":{"line":60,"column":4},"end":{"line":63,"column":5}},{"start":{},"end":{}}],"line":60},"2":{"loc":{"start":{"line":66,"column":4},"end":{"line":69,"column":5}},"type":"if","locations":[{"start":{"line":66,"column":4},"end":{"line":69,"column":5}},{"start":{},"end":{}}],"line":66},"3":{"loc":{"start":{"line":72,"column":4},"end":{"line":76,"column":5}},"type":"if","locations":[{"start":{"line":72,"column":4},"end":{"line":76,"column":5}},{"start":{"line":74,"column":11},"end":{"line":76,"column":5}}],"line":72},"4":{"loc":{"start":{"line":79,"column":4},"end":{"line":86,"column":5}},"type":"if","locations":[{"start":{"line":79,"column":4},"end":{"line":86,"column":5}},{"start":{"line":82,"column":11},"end":{"line":86,"column":5}}],"line":79},"5":{"loc":{"start":{"line":96,"column":4},"end":{"line":100,"column":5}},"type":"if","locations":[{"start":{"line":96,"column":4},"end":{"line":100,"column":5}},{"start":{"line":98,"column":11},"end":{"line":100,"column":5}}],"line":96},"6":{"loc":{"start":{"line":118,"column":4},"end":{"line":120,"column":5}},"type":"if","locations":[{"start":{"line":118,"column":4},"end":{"line":120,"column":5}},{"start":{},"end":{}}],"line":118}},"s":{"0":21,"1":21,"2":21,"3":79,"4":79,"5":262,"6":62,"7":48,"8":12,"9":75,"10":75,"11":75,"12":21,"13":21,"14":75,"15":56,"16":56,"17":75,"18":1,"19":74,"20":74,"21":40,"22":34,"23":34,"24":74,"25":5,"26":4,"27":1,"28":4,"29":4,"30":4,"31":4,"32":20,"33":20,"34":2,"35":18,"36":2,"37":8,"38":1,"39":3,"40":3,"41":3,"42":1,"43":3,"44":3,"45":12,"46":3,"47":2,"48":2,"49":2,"50":8,"51":2,"52":8,"53":12,"54":12,"55":2,"56":7},"f":{"0":21,"1":79,"2":262,"3":62,"4":48,"5":12,"6":75,"7":5,"8":20,"9":2,"10":8,"11":1,"12":3,"13":3,"14":12,"15":2,"16":8,"17":8,"18":12,"19":7},"b":{"0":[11],"1":[21,54],"2":[56,19],"3":[1,74],"4":[40,34],"5":[4,1],"6":[2,18]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"b14aeb10b42de3aa91353190d0dc87c422c38200"} +,"/home/brunolnetto/github/path_finder/src/data-structures/graph/GraphEdge.js": {"path":"/home/brunolnetto/github/path_finder/src/data-structures/graph/GraphEdge.js","statementMap":{"0":{"start":{"line":8,"column":4},"end":{"line":8,"column":35}},"1":{"start":{"line":9,"column":4},"end":{"line":9,"column":31}},"2":{"start":{"line":10,"column":4},"end":{"line":10,"column":25}},"3":{"start":{"line":17,"column":27},"end":{"line":17,"column":52}},"4":{"start":{"line":18,"column":25},"end":{"line":18,"column":48}},"5":{"start":{"line":20,"column":4},"end":{"line":20,"column":47}},"6":{"start":{"line":27,"column":16},"end":{"line":27,"column":32}},"7":{"start":{"line":28,"column":4},"end":{"line":28,"column":38}},"8":{"start":{"line":29,"column":4},"end":{"line":29,"column":25}},"9":{"start":{"line":31,"column":4},"end":{"line":31,"column":16}},"10":{"start":{"line":38,"column":4},"end":{"line":38,"column":25}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":7,"column":2},"end":{"line":7,"column":3}},"loc":{"start":{"line":7,"column":50},"end":{"line":11,"column":3}},"line":7},"1":{"name":"(anonymous_1)","decl":{"start":{"line":16,"column":2},"end":{"line":16,"column":3}},"loc":{"start":{"line":16,"column":11},"end":{"line":21,"column":3}},"line":16},"2":{"name":"(anonymous_2)","decl":{"start":{"line":26,"column":2},"end":{"line":26,"column":3}},"loc":{"start":{"line":26,"column":12},"end":{"line":32,"column":3}},"line":26},"3":{"name":"(anonymous_3)","decl":{"start":{"line":37,"column":2},"end":{"line":37,"column":3}},"loc":{"start":{"line":37,"column":13},"end":{"line":39,"column":3}},"line":37}},"branchMap":{"0":{"loc":{"start":{"line":7,"column":38},"end":{"line":7,"column":48}},"type":"default-arg","locations":[{"start":{"line":7,"column":47},"end":{"line":7,"column":48}}],"line":7}},"s":{"0":88,"1":88,"2":88,"3":248,"4":248,"5":248,"6":4,"7":4,"8":4,"9":4,"10":5},"f":{"0":88,"1":248,"2":4,"3":5},"b":{"0":[76]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"a0f7d59626f12440a5511ded272fc7a23112d414"} +,"/home/brunolnetto/github/path_finder/src/data-structures/graph/GraphVertex.js": {"path":"/home/brunolnetto/github/path_finder/src/data-structures/graph/GraphVertex.js","statementMap":{"0":{"start":{"line":8,"column":4},"end":{"line":10,"column":5}},"1":{"start":{"line":9,"column":6},"end":{"line":9,"column":56}},"2":{"start":{"line":16,"column":27},"end":{"line":22,"column":5}},"3":{"start":{"line":17,"column":6},"end":{"line":19,"column":7}},"4":{"start":{"line":18,"column":8},"end":{"line":18,"column":17}},"5":{"start":{"line":21,"column":6},"end":{"line":21,"column":54}},"6":{"start":{"line":26,"column":4},"end":{"line":26,"column":23}},"7":{"start":{"line":27,"column":4},"end":{"line":27,"column":48}},"8":{"start":{"line":35,"column":4},"end":{"line":35,"column":28}},"9":{"start":{"line":37,"column":4},"end":{"line":37,"column":16}},"10":{"start":{"line":44,"column":4},"end":{"line":44,"column":28}},"11":{"start":{"line":51,"column":18},"end":{"line":51,"column":38}},"12":{"start":{"line":54,"column":31},"end":{"line":56,"column":5}},"13":{"start":{"line":55,"column":6},"end":{"line":55,"column":93}},"14":{"start":{"line":60,"column":4},"end":{"line":60,"column":41}},"15":{"start":{"line":67,"column":4},"end":{"line":67,"column":78}},"16":{"start":{"line":67,"column":56},"end":{"line":67,"column":76}},"17":{"start":{"line":74,"column":4},"end":{"line":74,"column":39}},"18":{"start":{"line":82,"column":21},"end":{"line":84,"column":6}},"19":{"start":{"line":83,"column":26},"end":{"line":83,"column":47}},"20":{"start":{"line":86,"column":4},"end":{"line":86,"column":22}},"21":{"start":{"line":94,"column":23},"end":{"line":96,"column":6}},"22":{"start":{"line":95,"column":26},"end":{"line":95,"column":82}},"23":{"start":{"line":98,"column":4},"end":{"line":98,"column":24}},"24":{"start":{"line":106,"column":23},"end":{"line":108,"column":5}},"25":{"start":{"line":107,"column":6},"end":{"line":107,"column":70}},"26":{"start":{"line":110,"column":17},"end":{"line":110,"column":58}},"27":{"start":{"line":112,"column":4},"end":{"line":112,"column":36}},"28":{"start":{"line":119,"column":4},"end":{"line":119,"column":22}},"29":{"start":{"line":126,"column":4},"end":{"line":126,"column":61}},"30":{"start":{"line":126,"column":38},"end":{"line":126,"column":59}},"31":{"start":{"line":128,"column":4},"end":{"line":128,"column":16}},"32":{"start":{"line":136,"column":4},"end":{"line":136,"column":61}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":7,"column":2},"end":{"line":7,"column":3}},"loc":{"start":{"line":7,"column":21},"end":{"line":28,"column":3}},"line":7},"1":{"name":"(anonymous_1)","decl":{"start":{"line":16,"column":27},"end":{"line":16,"column":28}},"loc":{"start":{"line":16,"column":45},"end":{"line":22,"column":5}},"line":16},"2":{"name":"(anonymous_2)","decl":{"start":{"line":34,"column":2},"end":{"line":34,"column":3}},"loc":{"start":{"line":34,"column":16},"end":{"line":38,"column":3}},"line":34},"3":{"name":"(anonymous_3)","decl":{"start":{"line":43,"column":2},"end":{"line":43,"column":3}},"loc":{"start":{"line":43,"column":19},"end":{"line":45,"column":3}},"line":43},"4":{"name":"(anonymous_4)","decl":{"start":{"line":50,"column":2},"end":{"line":50,"column":3}},"loc":{"start":{"line":50,"column":17},"end":{"line":61,"column":3}},"line":50},"5":{"name":"(anonymous_5)","decl":{"start":{"line":54,"column":31},"end":{"line":54,"column":32}},"loc":{"start":{"line":54,"column":41},"end":{"line":56,"column":5}},"line":54},"6":{"name":"(anonymous_6)","decl":{"start":{"line":66,"column":2},"end":{"line":66,"column":3}},"loc":{"start":{"line":66,"column":13},"end":{"line":68,"column":3}},"line":66},"7":{"name":"(anonymous_7)","decl":{"start":{"line":67,"column":36},"end":{"line":67,"column":37}},"loc":{"start":{"line":67,"column":56},"end":{"line":67,"column":76}},"line":67},"8":{"name":"(anonymous_8)","decl":{"start":{"line":73,"column":2},"end":{"line":73,"column":3}},"loc":{"start":{"line":73,"column":14},"end":{"line":75,"column":3}},"line":73},"9":{"name":"(anonymous_9)","decl":{"start":{"line":81,"column":2},"end":{"line":81,"column":3}},"loc":{"start":{"line":81,"column":24},"end":{"line":87,"column":3}},"line":81},"10":{"name":"(anonymous_10)","decl":{"start":{"line":83,"column":16},"end":{"line":83,"column":17}},"loc":{"start":{"line":83,"column":26},"end":{"line":83,"column":47}},"line":83},"11":{"name":"(anonymous_11)","decl":{"start":{"line":93,"column":2},"end":{"line":93,"column":3}},"loc":{"start":{"line":93,"column":22},"end":{"line":99,"column":3}},"line":93},"12":{"name":"(anonymous_12)","decl":{"start":{"line":95,"column":16},"end":{"line":95,"column":17}},"loc":{"start":{"line":95,"column":26},"end":{"line":95,"column":82}},"line":95},"13":{"name":"(anonymous_13)","decl":{"start":{"line":105,"column":2},"end":{"line":105,"column":3}},"loc":{"start":{"line":105,"column":19},"end":{"line":113,"column":3}},"line":105},"14":{"name":"(anonymous_14)","decl":{"start":{"line":106,"column":23},"end":{"line":106,"column":24}},"loc":{"start":{"line":106,"column":33},"end":{"line":108,"column":5}},"line":106},"15":{"name":"(anonymous_15)","decl":{"start":{"line":118,"column":2},"end":{"line":118,"column":3}},"loc":{"start":{"line":118,"column":11},"end":{"line":120,"column":3}},"line":118},"16":{"name":"(anonymous_16)","decl":{"start":{"line":125,"column":2},"end":{"line":125,"column":3}},"loc":{"start":{"line":125,"column":19},"end":{"line":129,"column":3}},"line":125},"17":{"name":"(anonymous_17)","decl":{"start":{"line":126,"column":28},"end":{"line":126,"column":29}},"loc":{"start":{"line":126,"column":38},"end":{"line":126,"column":59}},"line":126},"18":{"name":"(anonymous_18)","decl":{"start":{"line":135,"column":2},"end":{"line":135,"column":3}},"loc":{"start":{"line":135,"column":21},"end":{"line":137,"column":3}},"line":135}},"branchMap":{"0":{"loc":{"start":{"line":8,"column":4},"end":{"line":10,"column":5}},"type":"if","locations":[{"start":{"line":8,"column":4},"end":{"line":10,"column":5}},{"start":{},"end":{}}],"line":8},"1":{"loc":{"start":{"line":17,"column":6},"end":{"line":19,"column":7}},"type":"if","locations":[{"start":{"line":17,"column":6},"end":{"line":19,"column":7}},{"start":{},"end":{}}],"line":17},"2":{"loc":{"start":{"line":21,"column":13},"end":{"line":21,"column":53}},"type":"cond-expr","locations":[{"start":{"line":21,"column":47},"end":{"line":21,"column":49}},{"start":{"line":21,"column":52},"end":{"line":21,"column":53}}],"line":21},"3":{"loc":{"start":{"line":55,"column":13},"end":{"line":55,"column":92}},"type":"cond-expr","locations":[{"start":{"line":55,"column":47},"end":{"line":55,"column":67}},{"start":{"line":55,"column":70},"end":{"line":55,"column":92}}],"line":55},"4":{"loc":{"start":{"line":95,"column":26},"end":{"line":95,"column":82}},"type":"binary-expr","locations":[{"start":{"line":95,"column":26},"end":{"line":95,"column":53}},{"start":{"line":95,"column":57},"end":{"line":95,"column":82}}],"line":95},"5":{"loc":{"start":{"line":107,"column":13},"end":{"line":107,"column":69}},"type":"binary-expr","locations":[{"start":{"line":107,"column":13},"end":{"line":107,"column":40}},{"start":{"line":107,"column":44},"end":{"line":107,"column":69}}],"line":107},"6":{"loc":{"start":{"line":112,"column":11},"end":{"line":112,"column":35}},"type":"cond-expr","locations":[{"start":{"line":112,"column":18},"end":{"line":112,"column":28}},{"start":{"line":112,"column":31},"end":{"line":112,"column":35}}],"line":112},"7":{"loc":{"start":{"line":136,"column":11},"end":{"line":136,"column":60}},"type":"cond-expr","locations":[{"start":{"line":136,"column":22},"end":{"line":136,"column":42}},{"start":{"line":136,"column":45},"end":{"line":136,"column":60}}],"line":136}},"s":{"0":112,"1":1,"2":111,"3":26,"4":12,"5":14,"6":111,"7":111,"8":122,"9":122,"10":12,"11":84,"12":84,"13":104,"14":84,"15":12,"16":16,"17":4,"18":18,"19":9,"20":18,"21":2,"22":2,"23":2,"24":20,"25":25,"26":20,"27":20,"28":1235,"29":1,"30":2,"31":1,"32":1},"f":{"0":112,"1":26,"2":122,"3":12,"4":84,"5":104,"6":12,"7":16,"8":4,"9":18,"10":9,"11":2,"12":2,"13":20,"14":25,"15":1235,"16":1,"17":2,"18":1},"b":{"0":[1,111],"1":[12,14],"2":[2,12],"3":[83,21],"4":[2,2],"5":[25,20],"6":[16,4],"7":[0,1]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"7014969a0e0d8d1e0588648c408eef5646746921"} +,"/home/brunolnetto/github/path_finder/src/data-structures/linked-list/LinkedList.js": {"path":"/home/brunolnetto/github/path_finder/src/data-structures/linked-list/LinkedList.js","statementMap":{"0":{"start":{"line":10,"column":4},"end":{"line":10,"column":21}},"1":{"start":{"line":13,"column":4},"end":{"line":13,"column":21}},"2":{"start":{"line":15,"column":4},"end":{"line":15,"column":54}},"3":{"start":{"line":24,"column":20},"end":{"line":24,"column":56}},"4":{"start":{"line":25,"column":4},"end":{"line":25,"column":24}},"5":{"start":{"line":28,"column":4},"end":{"line":30,"column":5}},"6":{"start":{"line":29,"column":6},"end":{"line":29,"column":26}},"7":{"start":{"line":32,"column":4},"end":{"line":32,"column":16}},"8":{"start":{"line":40,"column":20},"end":{"line":40,"column":45}},"9":{"start":{"line":43,"column":4},"end":{"line":48,"column":5}},"10":{"start":{"line":44,"column":6},"end":{"line":44,"column":26}},"11":{"start":{"line":45,"column":6},"end":{"line":45,"column":26}},"12":{"start":{"line":47,"column":6},"end":{"line":47,"column":18}},"13":{"start":{"line":51,"column":4},"end":{"line":51,"column":29}},"14":{"start":{"line":52,"column":4},"end":{"line":52,"column":24}},"15":{"start":{"line":54,"column":4},"end":{"line":54,"column":16}},"16":{"start":{"line":62,"column":4},"end":{"line":64,"column":5}},"17":{"start":{"line":63,"column":6},"end":{"line":63,"column":18}},"18":{"start":{"line":66,"column":22},"end":{"line":66,"column":26}},"19":{"start":{"line":70,"column":4},"end":{"line":73,"column":5}},"20":{"start":{"line":71,"column":6},"end":{"line":71,"column":30}},"21":{"start":{"line":72,"column":6},"end":{"line":72,"column":33}},"22":{"start":{"line":75,"column":22},"end":{"line":75,"column":31}},"23":{"start":{"line":77,"column":4},"end":{"line":87,"column":5}},"24":{"start":{"line":79,"column":6},"end":{"line":86,"column":7}},"25":{"start":{"line":80,"column":8},"end":{"line":85,"column":9}},"26":{"start":{"line":81,"column":10},"end":{"line":81,"column":41}},"27":{"start":{"line":82,"column":10},"end":{"line":82,"column":51}},"28":{"start":{"line":84,"column":10},"end":{"line":84,"column":41}},"29":{"start":{"line":90,"column":4},"end":{"line":92,"column":5}},"30":{"start":{"line":91,"column":6},"end":{"line":91,"column":30}},"31":{"start":{"line":94,"column":4},"end":{"line":94,"column":23}},"32":{"start":{"line":104,"column":4},"end":{"line":106,"column":5}},"33":{"start":{"line":105,"column":6},"end":{"line":105,"column":18}},"34":{"start":{"line":108,"column":22},"end":{"line":108,"column":31}},"35":{"start":{"line":110,"column":4},"end":{"line":122,"column":5}},"36":{"start":{"line":112,"column":6},"end":{"line":114,"column":7}},"37":{"start":{"line":113,"column":8},"end":{"line":113,"column":27}},"38":{"start":{"line":117,"column":6},"end":{"line":119,"column":7}},"39":{"start":{"line":118,"column":8},"end":{"line":118,"column":27}},"40":{"start":{"line":121,"column":6},"end":{"line":121,"column":37}},"41":{"start":{"line":124,"column":4},"end":{"line":124,"column":16}},"42":{"start":{"line":131,"column":24},"end":{"line":131,"column":33}},"43":{"start":{"line":133,"column":4},"end":{"line":139,"column":5}},"44":{"start":{"line":135,"column":6},"end":{"line":135,"column":23}},"45":{"start":{"line":136,"column":6},"end":{"line":136,"column":23}},"46":{"start":{"line":138,"column":6},"end":{"line":138,"column":25}},"47":{"start":{"line":144,"column":22},"end":{"line":144,"column":31}},"48":{"start":{"line":145,"column":4},"end":{"line":151,"column":5}},"49":{"start":{"line":146,"column":6},"end":{"line":150,"column":7}},"50":{"start":{"line":147,"column":8},"end":{"line":147,"column":32}},"51":{"start":{"line":149,"column":8},"end":{"line":149,"column":39}},"52":{"start":{"line":153,"column":4},"end":{"line":153,"column":28}},"53":{"start":{"line":155,"column":4},"end":{"line":155,"column":23}},"54":{"start":{"line":162,"column":4},"end":{"line":164,"column":5}},"55":{"start":{"line":163,"column":6},"end":{"line":163,"column":18}},"56":{"start":{"line":166,"column":24},"end":{"line":166,"column":33}},"57":{"start":{"line":168,"column":4},"end":{"line":173,"column":5}},"58":{"start":{"line":169,"column":6},"end":{"line":169,"column":33}},"59":{"start":{"line":171,"column":6},"end":{"line":171,"column":23}},"60":{"start":{"line":172,"column":6},"end":{"line":172,"column":23}},"61":{"start":{"line":175,"column":4},"end":{"line":175,"column":23}},"62":{"start":{"line":183,"column":4},"end":{"line":183,"column":50}},"63":{"start":{"line":183,"column":30},"end":{"line":183,"column":48}},"64":{"start":{"line":185,"column":4},"end":{"line":185,"column":16}},"65":{"start":{"line":192,"column":18},"end":{"line":192,"column":20}},"66":{"start":{"line":194,"column":22},"end":{"line":194,"column":31}},"67":{"start":{"line":195,"column":4},"end":{"line":198,"column":5}},"68":{"start":{"line":196,"column":6},"end":{"line":196,"column":30}},"69":{"start":{"line":197,"column":6},"end":{"line":197,"column":37}},"70":{"start":{"line":200,"column":4},"end":{"line":200,"column":17}},"71":{"start":{"line":208,"column":4},"end":{"line":208,"column":76}},"72":{"start":{"line":208,"column":40},"end":{"line":208,"column":63}},"73":{"start":{"line":216,"column":19},"end":{"line":216,"column":28}},"74":{"start":{"line":217,"column":19},"end":{"line":217,"column":23}},"75":{"start":{"line":218,"column":19},"end":{"line":218,"column":23}},"76":{"start":{"line":220,"column":4},"end":{"line":230,"column":5}},"77":{"start":{"line":222,"column":6},"end":{"line":222,"column":31}},"78":{"start":{"line":225,"column":6},"end":{"line":225,"column":31}},"79":{"start":{"line":228,"column":6},"end":{"line":228,"column":26}},"80":{"start":{"line":229,"column":6},"end":{"line":229,"column":26}},"81":{"start":{"line":233,"column":4},"end":{"line":233,"column":26}},"82":{"start":{"line":234,"column":4},"end":{"line":234,"column":25}},"83":{"start":{"line":236,"column":4},"end":{"line":236,"column":16}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":8,"column":2},"end":{"line":8,"column":3}},"loc":{"start":{"line":8,"column":34},"end":{"line":16,"column":3}},"line":8},"1":{"name":"(anonymous_1)","decl":{"start":{"line":22,"column":2},"end":{"line":22,"column":3}},"loc":{"start":{"line":22,"column":17},"end":{"line":33,"column":3}},"line":22},"2":{"name":"(anonymous_2)","decl":{"start":{"line":39,"column":2},"end":{"line":39,"column":3}},"loc":{"start":{"line":39,"column":16},"end":{"line":55,"column":3}},"line":39},"3":{"name":"(anonymous_3)","decl":{"start":{"line":61,"column":2},"end":{"line":61,"column":3}},"loc":{"start":{"line":61,"column":16},"end":{"line":95,"column":3}},"line":61},"4":{"name":"(anonymous_4)","decl":{"start":{"line":103,"column":2},"end":{"line":103,"column":3}},"loc":{"start":{"line":103,"column":52},"end":{"line":125,"column":3}},"line":103},"5":{"name":"(anonymous_5)","decl":{"start":{"line":130,"column":2},"end":{"line":130,"column":3}},"loc":{"start":{"line":130,"column":15},"end":{"line":156,"column":3}},"line":130},"6":{"name":"(anonymous_6)","decl":{"start":{"line":161,"column":2},"end":{"line":161,"column":3}},"loc":{"start":{"line":161,"column":15},"end":{"line":176,"column":3}},"line":161},"7":{"name":"(anonymous_7)","decl":{"start":{"line":182,"column":2},"end":{"line":182,"column":3}},"loc":{"start":{"line":182,"column":20},"end":{"line":186,"column":3}},"line":182},"8":{"name":"(anonymous_8)","decl":{"start":{"line":183,"column":19},"end":{"line":183,"column":20}},"loc":{"start":{"line":183,"column":30},"end":{"line":183,"column":48}},"line":183},"9":{"name":"(anonymous_9)","decl":{"start":{"line":191,"column":2},"end":{"line":191,"column":3}},"loc":{"start":{"line":191,"column":12},"end":{"line":201,"column":3}},"line":191},"10":{"name":"(anonymous_10)","decl":{"start":{"line":207,"column":2},"end":{"line":207,"column":3}},"loc":{"start":{"line":207,"column":21},"end":{"line":209,"column":3}},"line":207},"11":{"name":"(anonymous_11)","decl":{"start":{"line":208,"column":30},"end":{"line":208,"column":31}},"loc":{"start":{"line":208,"column":40},"end":{"line":208,"column":63}},"line":208},"12":{"name":"(anonymous_12)","decl":{"start":{"line":215,"column":2},"end":{"line":215,"column":3}},"loc":{"start":{"line":215,"column":12},"end":{"line":237,"column":3}},"line":215}},"branchMap":{"0":{"loc":{"start":{"line":28,"column":4},"end":{"line":30,"column":5}},"type":"if","locations":[{"start":{"line":28,"column":4},"end":{"line":30,"column":5}},{"start":{},"end":{}}],"line":28},"1":{"loc":{"start":{"line":43,"column":4},"end":{"line":48,"column":5}},"type":"if","locations":[{"start":{"line":43,"column":4},"end":{"line":48,"column":5}},{"start":{},"end":{}}],"line":43},"2":{"loc":{"start":{"line":62,"column":4},"end":{"line":64,"column":5}},"type":"if","locations":[{"start":{"line":62,"column":4},"end":{"line":64,"column":5}},{"start":{},"end":{}}],"line":62},"3":{"loc":{"start":{"line":70,"column":11},"end":{"line":70,"column":66}},"type":"binary-expr","locations":[{"start":{"line":70,"column":11},"end":{"line":70,"column":20}},{"start":{"line":70,"column":24},"end":{"line":70,"column":66}}],"line":70},"4":{"loc":{"start":{"line":77,"column":4},"end":{"line":87,"column":5}},"type":"if","locations":[{"start":{"line":77,"column":4},"end":{"line":87,"column":5}},{"start":{},"end":{}}],"line":77},"5":{"loc":{"start":{"line":80,"column":8},"end":{"line":85,"column":9}},"type":"if","locations":[{"start":{"line":80,"column":8},"end":{"line":85,"column":9}},{"start":{"line":83,"column":15},"end":{"line":85,"column":9}}],"line":80},"6":{"loc":{"start":{"line":90,"column":4},"end":{"line":92,"column":5}},"type":"if","locations":[{"start":{"line":90,"column":4},"end":{"line":92,"column":5}},{"start":{},"end":{}}],"line":90},"7":{"loc":{"start":{"line":103,"column":9},"end":{"line":103,"column":26}},"type":"default-arg","locations":[{"start":{"line":103,"column":17},"end":{"line":103,"column":26}}],"line":103},"8":{"loc":{"start":{"line":103,"column":28},"end":{"line":103,"column":48}},"type":"default-arg","locations":[{"start":{"line":103,"column":39},"end":{"line":103,"column":48}}],"line":103},"9":{"loc":{"start":{"line":104,"column":4},"end":{"line":106,"column":5}},"type":"if","locations":[{"start":{"line":104,"column":4},"end":{"line":106,"column":5}},{"start":{},"end":{}}],"line":104},"10":{"loc":{"start":{"line":112,"column":6},"end":{"line":114,"column":7}},"type":"if","locations":[{"start":{"line":112,"column":6},"end":{"line":114,"column":7}},{"start":{},"end":{}}],"line":112},"11":{"loc":{"start":{"line":112,"column":10},"end":{"line":112,"column":49}},"type":"binary-expr","locations":[{"start":{"line":112,"column":10},"end":{"line":112,"column":18}},{"start":{"line":112,"column":22},"end":{"line":112,"column":49}}],"line":112},"12":{"loc":{"start":{"line":117,"column":6},"end":{"line":119,"column":7}},"type":"if","locations":[{"start":{"line":117,"column":6},"end":{"line":119,"column":7}},{"start":{},"end":{}}],"line":117},"13":{"loc":{"start":{"line":117,"column":10},"end":{"line":117,"column":77}},"type":"binary-expr","locations":[{"start":{"line":117,"column":10},"end":{"line":117,"column":29}},{"start":{"line":117,"column":33},"end":{"line":117,"column":77}}],"line":117},"14":{"loc":{"start":{"line":133,"column":4},"end":{"line":139,"column":5}},"type":"if","locations":[{"start":{"line":133,"column":4},"end":{"line":139,"column":5}},{"start":{},"end":{}}],"line":133},"15":{"loc":{"start":{"line":146,"column":6},"end":{"line":150,"column":7}},"type":"if","locations":[{"start":{"line":146,"column":6},"end":{"line":150,"column":7}},{"start":{"line":148,"column":13},"end":{"line":150,"column":7}}],"line":146},"16":{"loc":{"start":{"line":162,"column":4},"end":{"line":164,"column":5}},"type":"if","locations":[{"start":{"line":162,"column":4},"end":{"line":164,"column":5}},{"start":{},"end":{}}],"line":162},"17":{"loc":{"start":{"line":168,"column":4},"end":{"line":173,"column":5}},"type":"if","locations":[{"start":{"line":168,"column":4},"end":{"line":173,"column":5}},{"start":{"line":170,"column":11},"end":{"line":173,"column":5}}],"line":168}},"s":{"0":125,"1":125,"2":125,"3":3,"4":3,"5":3,"6":1,"7":3,"8":167,"9":167,"10":87,"11":87,"12":87,"13":80,"14":80,"15":80,"16":19,"17":3,"18":16,"19":16,"20":12,"21":12,"22":16,"23":16,"24":12,"25":16,"26":5,"27":5,"28":11,"29":16,"30":6,"31":16,"32":50,"33":13,"34":37,"35":37,"36":57,"37":25,"38":32,"39":4,"40":28,"41":8,"42":3,"43":3,"44":1,"45":1,"46":1,"47":2,"48":2,"49":3,"50":2,"51":1,"52":2,"53":2,"54":3,"55":1,"56":2,"57":2,"58":1,"59":1,"60":1,"61":2,"62":2,"63":13,"64":2,"65":121,"66":121,"67":121,"68":173,"69":173,"70":121,"71":20,"72":44,"73":2,"74":2,"75":2,"76":2,"77":6,"78":6,"79":6,"80":6,"81":2,"82":2,"83":2},"f":{"0":125,"1":3,"2":167,"3":19,"4":50,"5":3,"6":3,"7":2,"8":13,"9":121,"10":20,"11":44,"12":2},"b":{"0":[1,2],"1":[87,80],"2":[3,16],"3":[28,24],"4":[12,4],"5":[5,11],"6":[6,10],"7":[43],"8":[7],"9":[13,37],"10":[25,32],"11":[57,42],"12":[4,28],"13":[32,15],"14":[1,2],"15":[2,1],"16":[1,2],"17":[1,1]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"1b44d13af773d77a9fb51fd67e81234e57ae834e"} +,"/home/brunolnetto/github/path_finder/src/data-structures/linked-list/LinkedListNode.js": {"path":"/home/brunolnetto/github/path_finder/src/data-structures/linked-list/LinkedListNode.js","statementMap":{"0":{"start":{"line":3,"column":4},"end":{"line":3,"column":23}},"1":{"start":{"line":4,"column":4},"end":{"line":4,"column":21}},"2":{"start":{"line":8,"column":4},"end":{"line":8,"column":61}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":2,"column":2},"end":{"line":2,"column":3}},"loc":{"start":{"line":2,"column":34},"end":{"line":5,"column":3}},"line":2},"1":{"name":"(anonymous_1)","decl":{"start":{"line":7,"column":2},"end":{"line":7,"column":3}},"loc":{"start":{"line":7,"column":21},"end":{"line":9,"column":3}},"line":7}},"branchMap":{"0":{"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":32}},"type":"default-arg","locations":[{"start":{"line":2,"column":28},"end":{"line":2,"column":32}}],"line":2},"1":{"loc":{"start":{"line":8,"column":11},"end":{"line":8,"column":60}},"type":"cond-expr","locations":[{"start":{"line":8,"column":22},"end":{"line":8,"column":42}},{"start":{"line":8,"column":45},"end":{"line":8,"column":60}}],"line":8}},"s":{"0":176,"1":176,"2":70},"f":{"0":176,"1":70},"b":{"0":[172],"1":[3,67]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"82de6c7c842e7a6e4a1596faf26966c0c21ad125"} +,"/home/brunolnetto/github/path_finder/src/utils/comparator/Comparator.js": {"path":"/home/brunolnetto/github/path_finder/src/utils/comparator/Comparator.js","statementMap":{"0":{"start":{"line":8,"column":4},"end":{"line":8,"column":72}},"1":{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},"2":{"start":{"line":19,"column":6},"end":{"line":19,"column":15}},"3":{"start":{"line":22,"column":4},"end":{"line":22,"column":26}},"4":{"start":{"line":32,"column":4},"end":{"line":32,"column":36}},"5":{"start":{"line":42,"column":4},"end":{"line":42,"column":34}},"6":{"start":{"line":52,"column":4},"end":{"line":52,"column":34}},"7":{"start":{"line":62,"column":4},"end":{"line":62,"column":51}},"8":{"start":{"line":72,"column":4},"end":{"line":72,"column":54}},"9":{"start":{"line":79,"column":28},"end":{"line":79,"column":40}},"10":{"start":{"line":80,"column":4},"end":{"line":80,"column":51}},"11":{"start":{"line":80,"column":29},"end":{"line":80,"column":50}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":7,"column":2},"end":{"line":7,"column":3}},"loc":{"start":{"line":7,"column":31},"end":{"line":9,"column":3}},"line":7},"1":{"name":"(anonymous_1)","decl":{"start":{"line":17,"column":2},"end":{"line":17,"column":3}},"loc":{"start":{"line":17,"column":38},"end":{"line":23,"column":3}},"line":17},"2":{"name":"(anonymous_2)","decl":{"start":{"line":31,"column":2},"end":{"line":31,"column":3}},"loc":{"start":{"line":31,"column":14},"end":{"line":33,"column":3}},"line":31},"3":{"name":"(anonymous_3)","decl":{"start":{"line":41,"column":2},"end":{"line":41,"column":3}},"loc":{"start":{"line":41,"column":17},"end":{"line":43,"column":3}},"line":41},"4":{"name":"(anonymous_4)","decl":{"start":{"line":51,"column":2},"end":{"line":51,"column":3}},"loc":{"start":{"line":51,"column":20},"end":{"line":53,"column":3}},"line":51},"5":{"name":"(anonymous_5)","decl":{"start":{"line":61,"column":2},"end":{"line":61,"column":3}},"loc":{"start":{"line":61,"column":24},"end":{"line":63,"column":3}},"line":61},"6":{"name":"(anonymous_6)","decl":{"start":{"line":71,"column":2},"end":{"line":71,"column":3}},"loc":{"start":{"line":71,"column":27},"end":{"line":73,"column":3}},"line":71},"7":{"name":"(anonymous_7)","decl":{"start":{"line":78,"column":2},"end":{"line":78,"column":3}},"loc":{"start":{"line":78,"column":12},"end":{"line":81,"column":3}},"line":78},"8":{"name":"(anonymous_8)","decl":{"start":{"line":80,"column":19},"end":{"line":80,"column":20}},"loc":{"start":{"line":80,"column":29},"end":{"line":80,"column":50}},"line":80}},"branchMap":{"0":{"loc":{"start":{"line":8,"column":19},"end":{"line":8,"column":71}},"type":"binary-expr","locations":[{"start":{"line":8,"column":19},"end":{"line":8,"column":34}},{"start":{"line":8,"column":38},"end":{"line":8,"column":71}}],"line":8},"1":{"loc":{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},"type":"if","locations":[{"start":{"line":18,"column":4},"end":{"line":20,"column":5}},{"start":{},"end":{}}],"line":18},"2":{"loc":{"start":{"line":22,"column":11},"end":{"line":22,"column":25}},"type":"cond-expr","locations":[{"start":{"line":22,"column":19},"end":{"line":22,"column":21}},{"start":{"line":22,"column":24},"end":{"line":22,"column":25}}],"line":22},"3":{"loc":{"start":{"line":62,"column":11},"end":{"line":62,"column":50}},"type":"binary-expr","locations":[{"start":{"line":62,"column":11},"end":{"line":62,"column":30}},{"start":{"line":62,"column":34},"end":{"line":62,"column":50}}],"line":62},"4":{"loc":{"start":{"line":72,"column":11},"end":{"line":72,"column":53}},"type":"binary-expr","locations":[{"start":{"line":72,"column":11},"end":{"line":72,"column":33}},{"start":{"line":72,"column":37},"end":{"line":72,"column":53}}],"line":72}},"s":{"0":127,"1":57,"2":22,"3":35,"4":87,"5":10,"6":11,"7":3,"8":9,"9":1,"10":1,"11":8},"f":{"0":127,"1":57,"2":87,"3":10,"4":11,"5":3,"6":9,"7":1,"8":8},"b":{"0":[127,13],"1":[22,35],"2":[20,15],"3":[3,3],"4":[9,6]},"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"0970272a21d2bcd0a9cdf32ec955409774784ade"} +} diff --git a/coverage/lcov-report/algorithms/depth-first-search/depthFirstSearch.js.html b/coverage/lcov-report/algorithms/depth-first-search/depthFirstSearch.js.html new file mode 100644 index 00000000..fbe8dfcd --- /dev/null +++ b/coverage/lcov-report/algorithms/depth-first-search/depthFirstSearch.js.html @@ -0,0 +1,289 @@ + + + + + + Code coverage report for algorithms/depth-first-search/depthFirstSearch.js + + + + + + + + + +
+
+

All files / algorithms/depth-first-search depthFirstSearch.js

+
+ +
+ 100% + Statements + 20/20 +
+ + +
+ 100% + Branches + 11/11 +
+ + +
+ 100% + Functions + 7/7 +
+ + +
+ 100% + Lines + 20/20 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +  +9x +  +9x +  +9x +  +9x +9x +16x +12x +12x +  +4x +  +  +  +  +9x +9x +9x +  +9x +  +  +  +  +  +  +  +  +  +47x +  +47x +63x +38x +  +  +  +47x +  +  +  +  +  +  +  +  +9x +9x +  + 
/**
+ * @typedef {Object} Callbacks
+ *
+ * @property {function(vertices: Object): boolean} [allowTraversal] -
+ *  Determines whether DFS should traverse from the vertex to its neighbor
+ *  (along the edge). By default prohibits visiting the same vertex again.
+ *
+ * @property {function(vertices: Object)} [enterVertex] - Called when DFS enters the vertex.
+ *
+ * @property {function(vertices: Object)} [leaveVertex] - Called when DFS leaves the vertex.
+ */
+ 
+/**
+ * @param {Callbacks} [callbacks]
+ * @returns {Callbacks}
+ */
+function initCallbacks(callbacks = {}) {
+  const initiatedCallback = callbacks;
+ 
+  const stubCallback = () => {};
+ 
+  const allowTraversalCallback = (
+    () => {
+      const seen = {};
+      return ({ nextVertex }) => {
+        if (!seen[nextVertex.getKey()]) {
+          seen[nextVertex.getKey()] = true;
+          return true;
+        }
+        return false;
+      };
+    }
+  )();
+ 
+  initiatedCallback.allowTraversal = callbacks.allowTraversal || allowTraversalCallback;
+  initiatedCallback.enterVertex = callbacks.enterVertex || stubCallback;
+  initiatedCallback.leaveVertex = callbacks.leaveVertex || stubCallback;
+ 
+  return initiatedCallback;
+}
+ 
+/**
+ * @param {Graph} graph
+ * @param {GraphVertex} currentVertex
+ * @param {GraphVertex} previousVertex
+ * @param {Callbacks} callbacks
+ */
+function depthFirstSearchRecursive(graph, currentVertex, previousVertex, callbacks) {
+  callbacks.enterVertex({ currentVertex, previousVertex });
+ 
+  graph.getNeighbors(currentVertex).forEach((nextVertex) => {
+    if (callbacks.allowTraversal({ previousVertex, currentVertex, nextVertex })) {
+      depthFirstSearchRecursive(graph, nextVertex, currentVertex, callbacks);
+    }
+  });
+ 
+  callbacks.leaveVertex({ currentVertex, previousVertex });
+}
+ 
+/**
+ * @param {Graph} graph
+ * @param {GraphVertex} startVertex
+ * @param {Callbacks} [callbacks]
+ */
+export default function depthFirstSearch(graph, startVertex, callbacks) {
+  const previousVertex = null;
+  depthFirstSearchRecursive(graph, startVertex, previousVertex, initCallbacks(callbacks));
+}
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/algorithms/depth-first-search/index.html b/coverage/lcov-report/algorithms/depth-first-search/index.html new file mode 100644 index 00000000..9d2fe473 --- /dev/null +++ b/coverage/lcov-report/algorithms/depth-first-search/index.html @@ -0,0 +1,116 @@ + + + + + + Code coverage report for algorithms/depth-first-search + + + + + + + + + +
+
+

All files algorithms/depth-first-search

+
+ +
+ 100% + Statements + 20/20 +
+ + +
+ 100% + Branches + 11/11 +
+ + +
+ 100% + Functions + 7/7 +
+ + +
+ 100% + Lines + 20/20 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
depthFirstSearch.js +
+
100%20/20100%11/11100%7/7100%20/20
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/algorithms/detect-cycle/detectDirectedCycle.js.html b/coverage/lcov-report/algorithms/detect-cycle/detectDirectedCycle.js.html new file mode 100644 index 00000000..9ee654b3 --- /dev/null +++ b/coverage/lcov-report/algorithms/detect-cycle/detectDirectedCycle.js.html @@ -0,0 +1,364 @@ + + + + + + Code coverage report for algorithms/detect-cycle/detectDirectedCycle.js + + + + + + + + + +
+
+

All files / algorithms/detect-cycle detectDirectedCycle.js

+
+ +
+ 100% + Statements + 30/30 +
+ + +
+ 100% + Branches + 4/4 +
+ + +
+ 100% + Functions + 5/5 +
+ + +
+ 100% + Lines + 30/30 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94  +  +  +  +  +  +  +  +2x +  +  +  +2x +  +  +2x +  +  +  +2x +  +  +  +2x +  +  +  +  +  +  +  +2x +12x +  +  +  +2x +  +13x +  +  +1x +  +1x +1x +  +1x +2x +2x +2x +  +  +1x +  +  +12x +12x +  +  +12x +  +  +  +  +  +13x +13x +  +  +  +  +15x +2x +  +  +  +  +13x +  +  +  +  +2x +  +4x +4x +  +  +4x +  +  +2x +  + 
import depthFirstSearch from '../depth-first-search/depthFirstSearch';
+ 
+/**
+ * Detect cycle in directed graph using Depth First Search.
+ *
+ * @param {Graph} graph
+ */
+export default function detectDirectedCycle(graph) {
+  let cycle = null;
+ 
+  // Will store parents (previous vertices) for all visited nodes.
+  // This will be needed in order to specify what path exactly is a cycle.
+  const dfsParentMap = {};
+ 
+  // White set (UNVISITED) contains all the vertices that haven't been visited at all.
+  const whiteSet = {};
+ 
+  // Gray set (VISITING) contains all the vertices that are being visited right now
+  // (in current path).
+  const graySet = {};
+ 
+  // Black set (VISITED) contains all the vertices that has been fully visited.
+  // Meaning that all children of the vertex has been visited.
+  const blackSet = {};
+ 
+  // If we encounter vertex in gray set it means that we've found a cycle.
+  // Because when vertex in gray set it means that its neighbors or its neighbors
+  // neighbors are still being explored.
+ 
+  // Init white set and add all vertices to it.
+  /** @param {GraphVertex} vertex */
+  graph.getAllVertices().forEach((vertex) => {
+    whiteSet[vertex.getKey()] = vertex;
+  });
+ 
+  // Describe BFS callbacks.
+  const callbacks = {
+    enterVertex: ({ currentVertex, previousVertex }) => {
+      if (graySet[currentVertex.getKey()]) {
+        // If current vertex already in grey set it means that cycle is detected.
+        // Let's detect cycle path.
+        cycle = {};
+ 
+        let currentCycleVertex = currentVertex;
+        let previousCycleVertex = previousVertex;
+ 
+        while (previousCycleVertex.getKey() !== currentVertex.getKey()) {
+          cycle[currentCycleVertex.getKey()] = previousCycleVertex;
+          currentCycleVertex = previousCycleVertex;
+          previousCycleVertex = dfsParentMap[previousCycleVertex.getKey()];
+        }
+ 
+        cycle[currentCycleVertex.getKey()] = previousCycleVertex;
+      } else {
+        // Otherwise let's add current vertex to gray set and remove it from white set.
+        graySet[currentVertex.getKey()] = currentVertex;
+        delete whiteSet[currentVertex.getKey()];
+ 
+        // Update DFS parents list.
+        dfsParentMap[currentVertex.getKey()] = previousVertex;
+      }
+    },
+    leaveVertex: ({ currentVertex }) => {
+      // If all node's children has been visited let's remove it from gray set
+      // and move it to the black set meaning that all its neighbors are visited.
+      blackSet[currentVertex.getKey()] = currentVertex;
+      delete graySet[currentVertex.getKey()];
+    },
+    allowTraversal: ({ nextVertex }) => {
+      // If cycle was detected we must forbid all further traversing since it will
+      // cause infinite traversal loop.
+      if (cycle) {
+        return false;
+      }
+ 
+      // Allow traversal only for the vertices that are not in black set
+      // since all black set vertices have been already visited.
+      return !blackSet[nextVertex.getKey()];
+    },
+  };
+ 
+  // Start exploring vertices.
+  while (Object.keys(whiteSet).length) {
+    // Pick fist vertex to start BFS from.
+    const firstWhiteKey = Object.keys(whiteSet)[0];
+    const startVertex = whiteSet[firstWhiteKey];
+ 
+    // Do Depth First Search.
+    depthFirstSearch(graph, startVertex, callbacks);
+  }
+ 
+  return cycle;
+}
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/algorithms/detect-cycle/detectUndirectedCycle.js.html b/coverage/lcov-report/algorithms/detect-cycle/detectUndirectedCycle.js.html new file mode 100644 index 00000000..7e9deaa7 --- /dev/null +++ b/coverage/lcov-report/algorithms/detect-cycle/detectUndirectedCycle.js.html @@ -0,0 +1,262 @@ + + + + + + Code coverage report for algorithms/detect-cycle/detectUndirectedCycle.js + + + + + + + + + +
+
+

All files / algorithms/detect-cycle detectUndirectedCycle.js

+
+ +
+ 100% + Statements + 23/23 +
+ + +
+ 100% + Branches + 6/6 +
+ + +
+ 100% + Functions + 3/3 +
+ + +
+ 100% + Lines + 23/23 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60  +  +  +  +  +  +  +  +2x +  +  +2x +  +  +2x +  +  +2x +  +  +25x +6x +  +  +  +19x +19x +  +19x +  +  +13x +  +1x +  +1x +1x +  +1x +3x +3x +3x +  +  +1x +  +  +12x +12x +  +  +  +  +  +2x +2x +  +2x +  + 
import depthFirstSearch from '../depth-first-search/depthFirstSearch';
+ 
+/**
+ * Detect cycle in undirected graph using Depth First Search.
+ *
+ * @param {Graph} graph
+ */
+export default function detectUndirectedCycle(graph) {
+  let cycle = null;
+ 
+  // List of vertices that we have visited.
+  const visitedVertices = {};
+ 
+  // List of parents vertices for every visited vertex.
+  const parents = {};
+ 
+  // Callbacks for DFS traversing.
+  const callbacks = {
+    allowTraversal: ({ currentVertex, nextVertex }) => {
+      // Don't allow further traversal in case if cycle has been detected.
+      if (cycle) {
+        return false;
+      }
+ 
+      // Don't allow traversal from child back to its parent.
+      const currentVertexParent = parents[currentVertex.getKey()];
+      const currentVertexParentKey = currentVertexParent ? currentVertexParent.getKey() : null;
+ 
+      return currentVertexParentKey !== nextVertex.getKey();
+    },
+    enterVertex: ({ currentVertex, previousVertex }) => {
+      if (visitedVertices[currentVertex.getKey()]) {
+        // Compile cycle path based on parents of previous vertices.
+        cycle = {};
+ 
+        let currentCycleVertex = currentVertex;
+        let previousCycleVertex = previousVertex;
+ 
+        while (previousCycleVertex.getKey() !== currentVertex.getKey()) {
+          cycle[currentCycleVertex.getKey()] = previousCycleVertex;
+          currentCycleVertex = previousCycleVertex;
+          previousCycleVertex = parents[previousCycleVertex.getKey()];
+        }
+ 
+        cycle[currentCycleVertex.getKey()] = previousCycleVertex;
+      } else {
+        // Add next vertex to visited set.
+        visitedVertices[currentVertex.getKey()] = currentVertex;
+        parents[currentVertex.getKey()] = previousVertex;
+      }
+    },
+  };
+ 
+  // Start DFS traversing.
+  const startVertex = graph.getAllVertices()[0];
+  depthFirstSearch(graph, startVertex, callbacks);
+ 
+  return cycle;
+}
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/algorithms/detect-cycle/detectUndirectedCycleUsingDisjointSet.js.html b/coverage/lcov-report/algorithms/detect-cycle/detectUndirectedCycleUsingDisjointSet.js.html new file mode 100644 index 00000000..07e00a69 --- /dev/null +++ b/coverage/lcov-report/algorithms/detect-cycle/detectUndirectedCycleUsingDisjointSet.js.html @@ -0,0 +1,178 @@ + + + + + + Code coverage report for algorithms/detect-cycle/detectUndirectedCycleUsingDisjointSet.js + + + + + + + + + +
+
+

All files / algorithms/detect-cycle detectUndirectedCycleUsingDisjointSet.js

+
+ +
+ 100% + Statements + 11/11 +
+ + +
+ 100% + Branches + 2/2 +
+ + +
+ 100% + Functions + 4/4 +
+ + +
+ 100% + Lines + 9/9 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32  +  +  +  +  +  +  +  +  +  +118x +2x +12x +  +  +  +  +  +2x +  +2x +11x +  +1x +  +10x +  +  +  +2x +  + 
import DisjointSet from '../../data-structures/disjoint-set/DisjointSet';
+ 
+/**
+ * Detect cycle in undirected graph using disjoint sets.
+ *
+ * @param {Graph} graph
+ */
+export default function detectUndirectedCycleUsingDisjointSet(graph) {
+  // Create initial singleton disjoint sets for each graph vertex.
+  /** @param {GraphVertex} graphVertex */
+  const keyExtractor = (graphVertex) => graphVertex.getKey();
+  const disjointSet = new DisjointSet(keyExtractor);
+  graph.getAllVertices().forEach((graphVertex) => disjointSet.makeSet(graphVertex));
+ 
+  // Go trough all graph edges one by one and check if edge vertices are from the
+  // different sets. In this case joint those sets together. Do this until you find
+  // an edge where to edge vertices are already in one set. This means that current
+  // edge will create a cycle.
+  let cycleFound = false;
+  /** @param {GraphEdge} graphEdge */
+  graph.getAllEdges().forEach((graphEdge) => {
+    if (disjointSet.inSameSet(graphEdge.startVertex, graphEdge.endVertex)) {
+      // Cycle found.
+      cycleFound = true;
+    } else {
+      disjointSet.union(graphEdge.startVertex, graphEdge.endVertex);
+    }
+  });
+ 
+  return cycleFound;
+}
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/algorithms/detect-cycle/index.html b/coverage/lcov-report/algorithms/detect-cycle/index.html new file mode 100644 index 00000000..4e78f6b0 --- /dev/null +++ b/coverage/lcov-report/algorithms/detect-cycle/index.html @@ -0,0 +1,146 @@ + + + + + + Code coverage report for algorithms/detect-cycle + + + + + + + + + +
+
+

All files algorithms/detect-cycle

+
+ +
+ 100% + Statements + 64/64 +
+ + +
+ 100% + Branches + 12/12 +
+ + +
+ 100% + Functions + 12/12 +
+ + +
+ 100% + Lines + 62/62 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
detectDirectedCycle.js +
+
100%30/30100%4/4100%5/5100%30/30
detectUndirectedCycle.js +
+
100%23/23100%6/6100%3/3100%23/23
detectUndirectedCycleUsingDisjointSet.js +
+
100%11/11100%2/2100%4/4100%9/9
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/base.css b/coverage/lcov-report/base.css new file mode 100644 index 00000000..f418035b --- /dev/null +++ b/coverage/lcov-report/base.css @@ -0,0 +1,224 @@ +body, html { + margin:0; padding: 0; + height: 100%; +} +body { + font-family: Helvetica Neue, Helvetica, Arial; + font-size: 14px; + color:#333; +} +.small { font-size: 12px; } +*, *:after, *:before { + -webkit-box-sizing:border-box; + -moz-box-sizing:border-box; + box-sizing:border-box; + } +h1 { font-size: 20px; margin: 0;} +h2 { font-size: 14px; } +pre { + font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; + margin: 0; + padding: 0; + -moz-tab-size: 2; + -o-tab-size: 2; + tab-size: 2; +} +a { color:#0074D9; text-decoration:none; } +a:hover { text-decoration:underline; } +.strong { font-weight: bold; } +.space-top1 { padding: 10px 0 0 0; } +.pad2y { padding: 20px 0; } +.pad1y { padding: 10px 0; } +.pad2x { padding: 0 20px; } +.pad2 { padding: 20px; } +.pad1 { padding: 10px; } +.space-left2 { padding-left:55px; } +.space-right2 { padding-right:20px; } +.center { text-align:center; } +.clearfix { display:block; } +.clearfix:after { + content:''; + display:block; + height:0; + clear:both; + visibility:hidden; + } +.fl { float: left; } +@media only screen and (max-width:640px) { + .col3 { width:100%; max-width:100%; } + .hide-mobile { display:none!important; } +} + +.quiet { + color: #7f7f7f; + color: rgba(0,0,0,0.5); +} +.quiet a { opacity: 0.7; } + +.fraction { + font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; + font-size: 10px; + color: #555; + background: #E8E8E8; + padding: 4px 5px; + border-radius: 3px; + vertical-align: middle; +} + +div.path a:link, div.path a:visited { color: #333; } +table.coverage { + border-collapse: collapse; + margin: 10px 0 0 0; + padding: 0; +} + +table.coverage td { + margin: 0; + padding: 0; + vertical-align: top; +} +table.coverage td.line-count { + text-align: right; + padding: 0 5px 0 20px; +} +table.coverage td.line-coverage { + text-align: right; + padding-right: 10px; + min-width:20px; +} + +table.coverage td span.cline-any { + display: inline-block; + padding: 0 5px; + width: 100%; +} +.missing-if-branch { + display: inline-block; + margin-right: 5px; + border-radius: 3px; + position: relative; + padding: 0 4px; + background: #333; + color: yellow; +} + +.skip-if-branch { + display: none; + margin-right: 10px; + position: relative; + padding: 0 4px; + background: #ccc; + color: white; +} +.missing-if-branch .typ, .skip-if-branch .typ { + color: inherit !important; +} +.coverage-summary { + border-collapse: collapse; + width: 100%; +} +.coverage-summary tr { border-bottom: 1px solid #bbb; } +.keyline-all { border: 1px solid #ddd; } +.coverage-summary td, .coverage-summary th { padding: 10px; } +.coverage-summary tbody { border: 1px solid #bbb; } +.coverage-summary td { border-right: 1px solid #bbb; } +.coverage-summary td:last-child { border-right: none; } +.coverage-summary th { + text-align: left; + font-weight: normal; + white-space: nowrap; +} +.coverage-summary th.file { border-right: none !important; } +.coverage-summary th.pct { } +.coverage-summary th.pic, +.coverage-summary th.abs, +.coverage-summary td.pct, +.coverage-summary td.abs { text-align: right; } +.coverage-summary td.file { white-space: nowrap; } +.coverage-summary td.pic { min-width: 120px !important; } +.coverage-summary tfoot td { } + +.coverage-summary .sorter { + height: 10px; + width: 7px; + display: inline-block; + margin-left: 0.5em; + background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; +} +.coverage-summary .sorted .sorter { + background-position: 0 -20px; +} +.coverage-summary .sorted-desc .sorter { + background-position: 0 -10px; +} +.status-line { height: 10px; } +/* yellow */ +.cbranch-no { background: yellow !important; color: #111; } +/* dark red */ +.red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } +.low .chart { border:1px solid #C21F39 } +.highlighted, +.highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{ + background: #C21F39 !important; +} +/* medium red */ +.cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } +/* light red */ +.low, .cline-no { background:#FCE1E5 } +/* light green */ +.high, .cline-yes { background:rgb(230,245,208) } +/* medium green */ +.cstat-yes { background:rgb(161,215,106) } +/* dark green */ +.status-line.high, .high .cover-fill { background:rgb(77,146,33) } +.high .chart { border:1px solid rgb(77,146,33) } +/* dark yellow (gold) */ +.status-line.medium, .medium .cover-fill { background: #f9cd0b; } +.medium .chart { border:1px solid #f9cd0b; } +/* light yellow */ +.medium { background: #fff4c2; } + +.cstat-skip { background: #ddd; color: #111; } +.fstat-skip { background: #ddd; color: #111 !important; } +.cbranch-skip { background: #ddd !important; color: #111; } + +span.cline-neutral { background: #eaeaea; } + +.coverage-summary td.empty { + opacity: .5; + padding-top: 4px; + padding-bottom: 4px; + line-height: 1; + color: #888; +} + +.cover-fill, .cover-empty { + display:inline-block; + height: 12px; +} +.chart { + line-height: 0; +} +.cover-empty { + background: white; +} +.cover-full { + border-right: none !important; +} +pre.prettyprint { + border: none !important; + padding: 0 !important; + margin: 0 !important; +} +.com { color: #999 !important; } +.ignore-none { color: #999; font-weight: normal; } + +.wrapper { + min-height: 100%; + height: auto !important; + height: 100%; + margin: 0 auto -48px; +} +.footer, .push { + height: 48px; +} diff --git a/coverage/lcov-report/block-navigation.js b/coverage/lcov-report/block-navigation.js new file mode 100644 index 00000000..cc121302 --- /dev/null +++ b/coverage/lcov-report/block-navigation.js @@ -0,0 +1,87 @@ +/* eslint-disable */ +var jumpToCode = (function init() { + // Classes of code we would like to highlight in the file view + var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no']; + + // Elements to highlight in the file listing view + var fileListingElements = ['td.pct.low']; + + // We don't want to select elements that are direct descendants of another match + var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > ` + + // Selecter that finds elements on the page to which we can jump + var selector = + fileListingElements.join(', ') + + ', ' + + notSelector + + missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b` + + // The NodeList of matching elements + var missingCoverageElements = document.querySelectorAll(selector); + + var currentIndex; + + function toggleClass(index) { + missingCoverageElements + .item(currentIndex) + .classList.remove('highlighted'); + missingCoverageElements.item(index).classList.add('highlighted'); + } + + function makeCurrent(index) { + toggleClass(index); + currentIndex = index; + missingCoverageElements.item(index).scrollIntoView({ + behavior: 'smooth', + block: 'center', + inline: 'center' + }); + } + + function goToPrevious() { + var nextIndex = 0; + if (typeof currentIndex !== 'number' || currentIndex === 0) { + nextIndex = missingCoverageElements.length - 1; + } else if (missingCoverageElements.length > 1) { + nextIndex = currentIndex - 1; + } + + makeCurrent(nextIndex); + } + + function goToNext() { + var nextIndex = 0; + + if ( + typeof currentIndex === 'number' && + currentIndex < missingCoverageElements.length - 1 + ) { + nextIndex = currentIndex + 1; + } + + makeCurrent(nextIndex); + } + + return function jump(event) { + if ( + document.getElementById('fileSearch') === document.activeElement && + document.activeElement != null + ) { + // if we're currently focused on the search input, we don't want to navigate + return; + } + + switch (event.which) { + case 78: // n + case 74: // j + goToNext(); + break; + case 66: // b + case 75: // k + case 80: // p + goToPrevious(); + break; + } + }; +})(); +window.addEventListener('keydown', jumpToCode); diff --git a/coverage/lcov-report/data-structures/disjoint-set/DisjointSet.js.html b/coverage/lcov-report/data-structures/disjoint-set/DisjointSet.js.html new file mode 100644 index 00000000..87940b8b --- /dev/null +++ b/coverage/lcov-report/data-structures/disjoint-set/DisjointSet.js.html @@ -0,0 +1,376 @@ + + + + + + Code coverage report for data-structures/disjoint-set/DisjointSet.js + + + + + + + + + +
+
+

All files / data-structures/disjoint-set DisjointSet.js

+
+ +
+ 100% + Statements + 29/29 +
+ + +
+ 93.75% + Branches + 15/16 +
+ + +
+ 100% + Functions + 5/5 +
+ + +
+ 100% + Lines + 29/29 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98  +  +  +  +  +  +  +7x +7x +  +  +  +  +  +  +  +26x +  +26x +  +26x +  +  +26x +  +  +  +  +  +  +  +  +  +128x +  +  +128x +  +128x +10x +  +  +118x +  +  +  +  +  +  +  +  +  +  +23x +23x +  +23x +1x +  +  +22x +  +1x +  +  +21x +21x +  +21x +  +1x +  +1x +  +  +  +20x +  +20x +  +  +  +  +  +  +  +  +29x +29x +  +29x +1x +  +  +28x +  +  + 
import DisjointSetItem from './DisjointSetItem'
+ 
+export default class DisjointSet {
+  /**
+   * @param {function(value: *)} [keyCallback]
+   */
+  constructor(keyCallback) {
+    this.keyCallback = keyCallback;
+    this.items = {};
+  }
+ 
+  /**
+   * @param {*} itemValue
+   * @return {DisjointSet}
+   */
+  makeSet(itemValue) {
+    const disjointSetItem = new DisjointSetItem(itemValue, this.keyCallback);
+ 
+    if (!this.items[disjointSetItem.getKey()]) {
+      // Add new item only in case if it not presented yet.
+      this.items[disjointSetItem.getKey()] = disjointSetItem;
+    }
+ 
+    return this;
+  }
+ 
+  /**
+   * Find set representation node.
+   *
+   * @param {*} itemValue
+   * @return {(string|null)}
+   */
+  find(itemValue) {
+    const templateDisjointItem = new DisjointSetItem(itemValue, this.keyCallback);
+ 
+    // Try to find item itself;
+    const requiredDisjointItem = this.items[templateDisjointItem.getKey()];
+ 
+    if (!requiredDisjointItem) {
+      return null;
+    }
+ 
+    return requiredDisjointItem.getRoot().getKey();
+  }
+ 
+  /**
+   * Union by rank.
+   *
+   * @param {*} valueA
+   * @param {*} valueB
+   * @return {DisjointSet}
+   */
+  union(valueA, valueB) {
+    const rootKeyA = this.find(valueA);
+    const rootKeyB = this.find(valueB);
+ 
+    if (rootKeyA === null || rootKeyB === null) {
+      throw new Error('One or two values are not in sets');
+    }
+ 
+    if (rootKeyA === rootKeyB) {
+      // In case if both elements are already in the same set then just return its key.
+      return this;
+    }
+ 
+    const rootA = this.items[rootKeyA];
+    const rootB = this.items[rootKeyB];
+ 
+    if (rootA.getRank() < rootB.getRank()) {
+      // If rootB's tree is bigger then make rootB to be a new root.
+      rootB.addChild(rootA);
+ 
+      return this;
+    }
+ 
+    // If rootA's tree is bigger then make rootA to be a new root.
+    rootA.addChild(rootB);
+ 
+    return this;
+  }
+ 
+  /**
+   * @param {*} valueA
+   * @param {*} valueB
+   * @return {boolean}
+   */
+  inSameSet(valueA, valueB) {
+    const rootKeyA = this.find(valueA);
+    const rootKeyB = this.find(valueB);
+ 
+    if (rootKeyA === null || rootKeyB === null) {
+      throw new Error('One or two values are not in sets');
+    }
+ 
+    return rootKeyA === rootKeyB;
+  }
+}
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/data-structures/disjoint-set/DisjointSetItem.js.html b/coverage/lcov-report/data-structures/disjoint-set/DisjointSetItem.js.html new file mode 100644 index 00000000..63f2a976 --- /dev/null +++ b/coverage/lcov-report/data-structures/disjoint-set/DisjointSetItem.js.html @@ -0,0 +1,373 @@ + + + + + + Code coverage report for data-structures/disjoint-set/DisjointSetItem.js + + + + + + + + + +
+
+

All files / data-structures/disjoint-set DisjointSetItem.js

+
+ +
+ 100% + Statements + 24/24 +
+ + +
+ 100% + Branches + 9/9 +
+ + +
+ 100% + Functions + 9/9 +
+ + +
+ 100% + Lines + 24/24 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97  +  +  +  +  +  +162x +162x +  +162x +162x +  +  +  +  +  +  +  +327x +185x +  +  +  +142x +  +  +  +  +  +  +177x +  +  +  +  +  +  +197x +  +  +  +  +  +  +  +  +105x +79x +  +  +26x +  +  +26x +  +47x +  +  +47x +  +  +26x +  +  +  +  +  +  +145x +  +  +  +  +  +  +  +  +29x +29x +2x +  +  +29x +  +  +  +  +  +  +  +27x +27x +  +27x +  +  + 
export default class DisjointSetItem {
+  /**
+   * @param {*} value
+   * @param {function(value: *)} [keyCallback]
+   */
+  constructor(value, keyCallback) {
+    this.value = value;
+    this.keyCallback = keyCallback;
+    /** @var {DisjointSetItem} this.parent */
+    this.parent = null;
+    this.children = {};
+  }
+ 
+  /**
+   * @return {*}
+   */
+  getKey() {
+    // Allow user to define custom key generator.
+    if (this.keyCallback) {
+      return this.keyCallback(this.value);
+    }
+ 
+    // Otherwise use value as a key by default.
+    return this.value;
+  }
+ 
+  /**
+   * @return {DisjointSetItem}
+   */
+  getRoot() {
+    return this.isRoot() ? this : this.parent.getRoot();
+  }
+ 
+  /**
+   * @return {boolean}
+   */
+  isRoot() {
+    return this.parent === null;
+  }
+ 
+  /**
+   * Rank basically means the number of all ancestors.
+   *
+   * @return {number}
+   */
+  getRank() {
+    if (this.getChildren().length === 0) {
+      return 0;
+    }
+ 
+    let rank = 0;
+ 
+    /** @var {DisjointSetItem} child */
+    this.getChildren().forEach((child) => {
+      // Count child itself.
+      rank += 1;
+ 
+      // Also add all children of current child.
+      rank += child.getRank();
+    });
+ 
+    return rank;
+  }
+ 
+  /**
+   * @return {DisjointSetItem[]}
+   */
+  getChildren() {
+    return Object.values(this.children);
+  }
+ 
+  /**
+   * @param {DisjointSetItem} parentItem
+   * @param {boolean} forceSettingParentChild
+   * @return {DisjointSetItem}
+   */
+  setParent(parentItem, forceSettingParentChild = true) {
+    this.parent = parentItem;
+    if (forceSettingParentChild) {
+      parentItem.addChild(this);
+    }
+ 
+    return this;
+  }
+ 
+  /**
+   * @param {DisjointSetItem} childItem
+   * @return {DisjointSetItem}
+   */
+  addChild(childItem) {
+    this.children[childItem.getKey()] = childItem;
+    childItem.setParent(this, false);
+ 
+    return this;
+  }
+}
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/data-structures/disjoint-set/index.html b/coverage/lcov-report/data-structures/disjoint-set/index.html new file mode 100644 index 00000000..67dc3a2d --- /dev/null +++ b/coverage/lcov-report/data-structures/disjoint-set/index.html @@ -0,0 +1,131 @@ + + + + + + Code coverage report for data-structures/disjoint-set + + + + + + + + + +
+
+

All files data-structures/disjoint-set

+
+ +
+ 100% + Statements + 53/53 +
+ + +
+ 96% + Branches + 24/25 +
+ + +
+ 100% + Functions + 14/14 +
+ + +
+ 100% + Lines + 53/53 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
DisjointSet.js +
+
100%29/2993.75%15/16100%5/5100%29/29
DisjointSetItem.js +
+
100%24/24100%9/9100%9/9100%24/24
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/data-structures/graph/Graph.js.html b/coverage/lcov-report/data-structures/graph/Graph.js.html new file mode 100644 index 00000000..d5da0ae5 --- /dev/null +++ b/coverage/lcov-report/data-structures/graph/Graph.js.html @@ -0,0 +1,673 @@ + + + + + + Code coverage report for data-structures/graph/Graph.js + + + + + + + + + +
+
+

All files / data-structures/graph Graph.js

+
+ +
+ 100% + Statements + 57/57 +
+ + +
+ 100% + Branches + 13/13 +
+ + +
+ 100% + Functions + 20/20 +
+ + +
+ 100% + Lines + 57/57 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197  +  +  +  +  +21x +21x +21x +  +  +  +  +  +  +  +79x +79x +  +  +  +  +  +  +  +262x +  +  +  +  +  +  +  +62x +  +  +  +  +  +  +48x +  +  +  +  +  +  +12x +  +  +  +  +  +  +  +  +75x +75x +  +  +75x +21x +21x +  +  +  +75x +56x +56x +  +  +  +75x +1x +  +74x +  +  +  +74x +  +40x +  +  +34x +34x +  +  +74x +  +  +  +  +  +  +  +5x +4x +  +1x +  +  +  +4x +4x +  +4x +4x +  +  +  +  +  +  +  +  +20x +  +20x +2x +  +  +18x +  +  +  +  +  +  +2x +8x +  +  +  +  +  +  +  +  +  +1x +  +3x +  +  +3x +  +  +3x +  +  +1x +  +  +  +  +  +  +3x +3x +12x +  +  +3x +  +  +  +  +  +  +2x +2x +  +  +  +2x +8x +  +  +  +2x +8x +12x +12x +  +  +  +2x +  +  +  +  +  +  +7x +  +  + 
export default class Graph {
+  /**
+   * @param {boolean} isDirected
+   */
+  constructor(isDirected = false) {
+    this.vertices = {};
+    this.edges = {};
+    this.isDirected = isDirected;
+  }
+ 
+  /**
+   * @param {GraphVertex} newVertex
+   * @returns {Graph}
+   */
+  addVertex(newVertex) {
+    this.vertices[newVertex.getKey()] = newVertex;
+    return this
+  }
+ 
+  /**
+   * @param {string} vertexKey
+   * @returns GraphVertex
+   */
+  getVertexByKey(vertexKey) {
+    return this.vertices[vertexKey];
+  }
+ 
+  /**
+   * @param {GraphVertex} vertex
+   * @returns {GraphVertex[]}
+   */
+  getNeighbors(vertex) {
+    return vertex.getNeighbors();
+  }
+ 
+  /**
+   * @return {GraphVertex[]}
+   */
+  getAllVertices() {
+    return Object.values(this.vertices);
+  }
+ 
+  /**
+   * @return {GraphEdge[]}
+   */
+  getAllEdges() {
+    return Object.values(this.edges);
+  }
+ 
+  /**
+   * @param {GraphEdge} edge
+   * @returns {Graph}
+   */
+  addEdge(edge) {
+    // Try to find and end start vertices.
+    let startVertex = this.getVertexByKey(edge.startVertex.getKey());
+    let endVertex = this.getVertexByKey(edge.endVertex.getKey());
+ 
+    // Insert start vertex if it wasn't inserted.
+    if (!startVertex) {
+      this.addVertex(edge.startVertex);
+      startVertex = this.getVertexByKey(edge.startVertex.getKey());
+    }
+ 
+    // Insert end vertex if it wasn't inserted.
+    if (!endVertex) {
+      this.addVertex(edge.endVertex);
+      endVertex = this.getVertexByKey(edge.endVertex.getKey());
+    }
+ 
+    // Check if edge has been already added.
+    if (this.edges[edge.getKey()]) {
+      throw new Error('Edge has already been added before');
+    } else {
+      this.edges[edge.getKey()] = edge;
+    }
+ 
+    // Add edge to the vertices.
+    if (this.isDirected) {
+      // If graph IS directed then add the edge only to start vertex.
+      startVertex.addEdge(edge);
+    } else {
+      // If graph ISN'T directed then add the edge to both vertices.
+      startVertex.addEdge(edge);
+      endVertex.addEdge(edge);
+    }
+ 
+    return this;
+  }
+ 
+  /**
+   * @param {GraphEdge} edge
+   */
+  deleteEdge(edge) {
+    // Delete edge from the list of edges.
+    if (this.edges[edge.getKey()]) {
+      delete this.edges[edge.getKey()];
+    } else {
+      throw new Error('Edge not found in graph');
+    }
+ 
+    // Try to find and end start vertices and delete edge from them.
+    const startVertex = this.getVertexByKey(edge.startVertex.getKey());
+    const endVertex = this.getVertexByKey(edge.endVertex.getKey());
+ 
+    startVertex.deleteEdge(edge);
+    endVertex.deleteEdge(edge);
+  }
+ 
+  /**
+   * @param {GraphVertex} startVertex
+   * @param {GraphVertex} endVertex
+   * @return {(GraphEdge|null)}
+   */
+  findEdge(startVertex, endVertex) {
+    const vertex = this.getVertexByKey(startVertex.getKey());
+ 
+    if (!vertex) {
+      return null;
+    }
+ 
+    return vertex.findEdge(endVertex);
+  }
+ 
+  /**
+   * @return {number}
+   */
+  getWeight() {
+    return this.getAllEdges().reduce((weight, graphEdge) => {
+      return weight + graphEdge.weight;
+    }, 0);
+  }
+ 
+  /**
+   * Reverse all the edges in directed graph.
+   * @return {Graph}
+   */
+  reverse() {
+    /** @param {GraphEdge} edge */
+    this.getAllEdges().forEach((edge) => {
+      // Delete straight edge from graph and from vertices.
+      this.deleteEdge(edge);
+ 
+      // Reverse the edge.
+      edge.reverse();
+ 
+      // Add reversed edge back to the graph and its vertices.
+      this.addEdge(edge);
+    });
+ 
+    return this;
+  }
+ 
+  /**
+   * @return {object}
+   */
+  getVerticesIndices() {
+    const verticesIndices = {};
+    this.getAllVertices().forEach((vertex, index) => {
+      verticesIndices[vertex.getKey()] = index;
+    });
+ 
+    return verticesIndices;
+  }
+ 
+  /**
+   * @return {*[][]}
+   */
+  getAdjacencyMatrix() {
+    const vertices = this.getAllVertices();
+    const verticesIndices = this.getVerticesIndices();
+ 
+    // Init matrix with infinities meaning that there is no ways of
+    // getting from one vertex to another yet.
+    const adjacencyMatrix = Array(vertices.length).fill(null).map(() => {
+      return Array(vertices.length).fill(Infinity);
+    });
+ 
+    // Fill the columns.
+    vertices.forEach((vertex, vertexIndex) => {
+      vertex.getNeighbors().forEach((neighbor) => {
+        const neighborIndex = verticesIndices[neighbor.getKey()];
+        adjacencyMatrix[vertexIndex][neighborIndex] = this.findEdge(vertex, neighbor).weight;
+      });
+    });
+ 
+    return adjacencyMatrix;
+  }
+ 
+  /**
+   * @return {string}
+   */
+  toString() {
+    return Object.keys(this.vertices).toString();
+  }
+}
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/data-structures/graph/GraphEdge.js.html b/coverage/lcov-report/data-structures/graph/GraphEdge.js.html new file mode 100644 index 00000000..f7c632dc --- /dev/null +++ b/coverage/lcov-report/data-structures/graph/GraphEdge.js.html @@ -0,0 +1,205 @@ + + + + + + Code coverage report for data-structures/graph/GraphEdge.js + + + + + + + + + +
+
+

All files / data-structures/graph GraphEdge.js

+
+ +
+ 100% + Statements + 11/11 +
+ + +
+ 100% + Branches + 1/1 +
+ + +
+ 100% + Functions + 4/4 +
+ + +
+ 100% + Lines + 11/11 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41  +  +  +  +  +  +  +88x +88x +88x +  +  +  +  +  +  +248x +248x +  +248x +  +  +  +  +  +  +4x +4x +4x +  +4x +  +  +  +  +  +  +5x +  +  + 
export default class GraphEdge {
+  /**
+   * @param {GraphVertex} startVertex
+   * @param {GraphVertex} endVertex
+   * @param {number} [weight=1]
+   */
+  constructor(startVertex, endVertex, weight = 0) {
+    this.startVertex = startVertex;
+    this.endVertex = endVertex;
+    this.weight = weight;
+  }
+ 
+  /**
+   * @return {string}
+   */
+  getKey() {
+    const startVertexKey = this.startVertex.getKey();
+    const endVertexKey = this.endVertex.getKey();
+ 
+    return `${startVertexKey}_${endVertexKey}`;
+  }
+ 
+  /**
+   * @return {GraphEdge}
+   */
+  reverse() {
+    const tmp = this.startVertex;
+    this.startVertex = this.endVertex;
+    this.endVertex = tmp;
+ 
+    return this;
+  }
+ 
+  /**
+   * @return {string}
+   */
+  toString() {
+    return this.getKey();
+  }
+}
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/data-structures/graph/GraphVertex.js.html b/coverage/lcov-report/data-structures/graph/GraphVertex.js.html new file mode 100644 index 00000000..bc484ac5 --- /dev/null +++ b/coverage/lcov-report/data-structures/graph/GraphVertex.js.html @@ -0,0 +1,499 @@ + + + + + + Code coverage report for data-structures/graph/GraphVertex.js + + + + + + + + + +
+
+

All files / data-structures/graph GraphVertex.js

+
+ +
+ 100% + Statements + 33/33 +
+ + +
+ 93.75% + Branches + 15/16 +
+ + +
+ 100% + Functions + 19/19 +
+ + +
+ 100% + Lines + 31/31 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139  +  +  +  +  +  +  +112x +1x +  +  +  +  +  +  +111x +26x +12x +  +  +14x +  +  +  +  +111x +111x +  +  +  +  +  +  +  +122x +  +122x +  +  +  +  +  +  +12x +  +  +  +  +  +  +84x +  +  +84x +104x +  +  +  +  +84x +  +  +  +  +  +  +16x +  +  +  +  +  +  +4x +  +  +  +  +  +  +  +18x +9x +  +  +18x +  +  +  +  +  +  +  +2x +2x +  +  +2x +  +  +  +  +  +  +  +20x +25x +  +  +20x +  +20x +  +  +  +  +  +  +1235x +  +  +  +  +  +  +2x +  +1x +  +  +  +  +  +  +  +1x +  +  + 
import LinkedList from '../linked-list/LinkedList.js'
+ 
+export default class GraphVertex {
+  /**
+   * @param {*} value
+   */
+  constructor(value) {
+    if (value === undefined) {
+      throw new Error('Graph vertex must have a value');
+    }
+ 
+    /**
+     * @param {GraphEdge} edgeA
+     * @param {GraphEdge} edgeB
+     */
+    const edgeComparator = (edgeA, edgeB) => {
+      if (edgeA.getKey() === edgeB.getKey()) {
+        return 0;
+      }
+ 
+      return edgeA.getKey() < edgeB.getKey() ? -1 : 1;
+    };
+ 
+    // Normally you would store string value like vertex name.
+    // But generally it may be any object as well
+    this.value = value;
+    this.edges = new LinkedList(edgeComparator);
+  }
+ 
+  /**
+   * @param {GraphEdge} edge
+   * @returns {GraphVertex}
+   */
+  addEdge(edge) {
+    this.edges.append(edge);
+ 
+    return this;
+  }
+ 
+  /**
+   * @param {GraphEdge} edge
+   */
+  deleteEdge(edge) {
+    this.edges.delete(edge);
+  }
+ 
+  /**
+   * @returns {GraphVertex[]}
+   */
+  getNeighbors() {
+    const edges = this.edges.toArray();
+ 
+    /** @param {LinkedListNode} node */
+    const neighborsConverter = (node) => {
+      return node.value.startVertex === this ? node.value.endVertex : node.value.startVertex;
+    };
+ 
+    // Return either start or end vertex.
+    // For undirected graphs it is possible that current vertex will be the end one.
+    return edges.map(neighborsConverter);
+  }
+ 
+  /**
+   * @return {GraphEdge[]}
+   */
+  getEdges() {
+    return this.edges.toArray().map((linkedListNode) => linkedListNode.value);
+  }
+ 
+  /**
+   * @return {number}
+   */
+  getDegree() {
+    return this.edges.toArray().length;
+  }
+ 
+  /**
+   * @param {GraphEdge} requiredEdge
+   * @returns {boolean}
+   */
+  hasEdge(requiredEdge) {
+    const edgeNode = this.edges.find({
+      callback: (edge) => edge === requiredEdge,
+    });
+ 
+    return !!edgeNode;
+  }
+ 
+  /**
+   * @param {GraphVertex} vertex
+   * @returns {boolean}
+   */
+  hasNeighbor(vertex) {
+    const vertexNode = this.edges.find({
+      callback: (edge) => edge.startVertex === vertex || edge.endVertex === vertex,
+    });
+ 
+    return !!vertexNode;
+  }
+ 
+  /**
+   * @param {GraphVertex} vertex
+   * @returns {(GraphEdge|null)}
+   */
+  findEdge(vertex) {
+    const edgeFinder = (edge) => {
+      return edge.startVertex === vertex || edge.endVertex === vertex;
+    };
+ 
+    const edge = this.edges.find({ callback: edgeFinder });
+ 
+    return edge ? edge.value : null;
+  }
+ 
+  /**
+   * @returns {string}
+   */
+  getKey() {
+    return this.value;
+  }
+ 
+  /**
+   * @return {GraphVertex}
+   */
+  deleteAllEdges() {
+    this.getEdges().forEach((edge) => this.deleteEdge(edge));
+ 
+    return this;
+  }
+ 
+  /**
+   * @param {function} [callback]
+   * @returns {string}
+   */
+  toString(callback) {
+    return callback ? callback(this.value) : `${this.value}`;
+  }
+}
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/data-structures/graph/index.html b/coverage/lcov-report/data-structures/graph/index.html new file mode 100644 index 00000000..5a8d6505 --- /dev/null +++ b/coverage/lcov-report/data-structures/graph/index.html @@ -0,0 +1,146 @@ + + + + + + Code coverage report for data-structures/graph + + + + + + + + + +
+
+

All files data-structures/graph

+
+ +
+ 100% + Statements + 101/101 +
+ + +
+ 96.66% + Branches + 29/30 +
+ + +
+ 100% + Functions + 43/43 +
+ + +
+ 100% + Lines + 99/99 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
Graph.js +
+
100%57/57100%13/13100%20/20100%57/57
GraphEdge.js +
+
100%11/11100%1/1100%4/4100%11/11
GraphVertex.js +
+
100%33/3393.75%15/16100%19/19100%31/31
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/data-structures/linked-list/LinkedList.js.html b/coverage/lcov-report/data-structures/linked-list/LinkedList.js.html new file mode 100644 index 00000000..3049dd71 --- /dev/null +++ b/coverage/lcov-report/data-structures/linked-list/LinkedList.js.html @@ -0,0 +1,799 @@ + + + + + + Code coverage report for data-structures/linked-list/LinkedList.js + + + + + + + + + +
+
+

All files / data-structures/linked-list LinkedList.js

+
+ +
+ 100% + Statements + 84/84 +
+ + +
+ 100% + Branches + 34/34 +
+ + +
+ 100% + Functions + 13/13 +
+ + +
+ 100% + Lines + 82/82 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84 +85 +86 +87 +88 +89 +90 +91 +92 +93 +94 +95 +96 +97 +98 +99 +100 +101 +102 +103 +104 +105 +106 +107 +108 +109 +110 +111 +112 +113 +114 +115 +116 +117 +118 +119 +120 +121 +122 +123 +124 +125 +126 +127 +128 +129 +130 +131 +132 +133 +134 +135 +136 +137 +138 +139 +140 +141 +142 +143 +144 +145 +146 +147 +148 +149 +150 +151 +152 +153 +154 +155 +156 +157 +158 +159 +160 +161 +162 +163 +164 +165 +166 +167 +168 +169 +170 +171 +172 +173 +174 +175 +176 +177 +178 +179 +180 +181 +182 +183 +184 +185 +186 +187 +188 +189 +190 +191 +192 +193 +194 +195 +196 +197 +198 +199 +200 +201 +202 +203 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 +223 +224 +225 +226 +227 +228 +229 +230 +231 +232 +233 +234 +235 +236 +237 +238 +239  +  +  +  +  +  +  +  +  +125x +  +  +125x +  +125x +  +  +  +  +  +  +  +  +3x +3x +  +  +3x +1x +  +  +3x +  +  +  +  +  +  +  +167x +  +  +167x +87x +87x +  +87x +  +  +  +80x +80x +  +80x +  +  +  +  +  +  +  +19x +3x +  +  +16x +  +  +  +16x +12x +12x +  +  +16x +  +16x +  +12x +16x +5x +5x +  +11x +  +  +  +  +  +16x +6x +  +  +16x +  +  +  +  +  +  +  +  +  +50x +13x +  +  +37x +  +37x +  +57x +25x +  +  +  +32x +4x +  +  +28x +  +  +8x +  +  +  +  +  +  +3x +  +3x +  +1x +1x +  +1x +  +  +  +  +  +2x +2x +3x +2x +  +1x +  +  +  +2x +  +2x +  +  +  +  +  +  +3x +1x +  +  +2x +  +2x +1x +  +1x +1x +  +  +2x +  +  +  +  +  +  +  +13x +  +2x +  +  +  +  +  +  +121x +  +121x +121x +173x +173x +  +  +121x +  +  +  +  +  +  +  +44x +  +  +  +  +  +  +  +2x +2x +2x +  +2x +  +6x +  +  +6x +  +  +6x +6x +  +  +  +2x +2x +  +2x +  +  + 
import LinkedListNode from './LinkedListNode.js'
+import Comparator from '../../utils/comparator/Comparator.js'
+ 
+export default class LinkedList {
+  /**
+   * @param {Function} [comparatorFunction]
+   */
+  constructor(comparatorFunction) {
+    /** @var LinkedListNode */
+    this.head = null;
+ 
+    /** @var LinkedListNode */
+    this.tail = null;
+ 
+    this.compare = new Comparator(comparatorFunction);
+  }
+ 
+  /**
+   * @param {*} value
+   * @return {LinkedList}
+   */
+  prepend(value) {
+    // Make new node to be a head.
+    const newNode = new LinkedListNode(value, this.head);
+    this.head = newNode;
+ 
+    // If there is no tail yet let's make new node a tail.
+    if (!this.tail) {
+      this.tail = newNode;
+    }
+ 
+    return this;
+  }
+ 
+  /**
+   * @param {*} value
+   * @return {LinkedList}
+   */
+  append(value) {
+    const newNode = new LinkedListNode(value);
+ 
+    // If there is no head yet let's make new node a head.
+    if (!this.head) {
+      this.head = newNode;
+      this.tail = newNode;
+ 
+      return this;
+    }
+ 
+    // Attach new node to the end of linked list.
+    this.tail.next = newNode;
+    this.tail = newNode;
+ 
+    return this;
+  }
+ 
+  /**
+   * @param {*} value
+   * @return {LinkedListNode}
+   */
+  delete(value) {
+    if (!this.head) {
+      return null;
+    }
+ 
+    let deletedNode = null;
+ 
+    // If the head must be deleted then make next node that is different
+    // from the head to be a new head.
+    while (this.head && this.compare.equal(this.head.value, value)) {
+      deletedNode = this.head;
+      this.head = this.head.next;
+    }
+ 
+    let currentNode = this.head;
+ 
+    if (currentNode !== null) {
+      // If next node must be deleted then make next node to be a next next one.
+      while (currentNode.next) {
+        if (this.compare.equal(currentNode.next.value, value)) {
+          deletedNode = currentNode.next;
+          currentNode.next = currentNode.next.next;
+        } else {
+          currentNode = currentNode.next;
+        }
+      }
+    }
+ 
+    // Check if tail must be deleted.
+    if (this.compare.equal(this.tail.value, value)) {
+      this.tail = currentNode;
+    }
+ 
+    return deletedNode;
+  }
+ 
+  /**
+   * @param {Object} findParams
+   * @param {*} findParams.value
+   * @param {function} [findParams.callback]
+   * @return {LinkedListNode}
+   */
+  find({ value = undefined, callback = undefined }) {
+    if (!this.head) {
+      return null;
+    }
+ 
+    let currentNode = this.head;
+ 
+    while (currentNode) {
+      // If callback is specified then try to find node by callback.
+      if (callback && callback(currentNode.value)) {
+        return currentNode;
+      }
+ 
+      // If value is specified then try to compare by value..
+      if (value !== undefined && this.compare.equal(currentNode.value, value)) {
+        return currentNode;
+      }
+ 
+      currentNode = currentNode.next;
+    }
+ 
+    return null;
+  }
+ 
+  /**
+   * @return {LinkedListNode}
+   */
+  deleteTail() {
+    const deletedTail = this.tail;
+ 
+    if (this.head === this.tail) {
+      // There is only one node in linked list.
+      this.head = null;
+      this.tail = null;
+ 
+      return deletedTail;
+    }
+ 
+    // If there are many nodes in linked list...
+ 
+    // Rewind to the last node and delete "next" link for the node before the last one.
+    let currentNode = this.head;
+    while (currentNode.next) {
+      if (!currentNode.next.next) {
+        currentNode.next = null;
+      } else {
+        currentNode = currentNode.next;
+      }
+    }
+ 
+    this.tail = currentNode;
+ 
+    return deletedTail;
+  }
+ 
+  /**
+   * @return {LinkedListNode}
+   */
+  deleteHead() {
+    if (!this.head) {
+      return null;
+    }
+ 
+    const deletedHead = this.head;
+ 
+    if (this.head.next) {
+      this.head = this.head.next;
+    } else {
+      this.head = null;
+      this.tail = null;
+    }
+ 
+    return deletedHead;
+  }
+ 
+  /**
+   * @param {*[]} values - Array of values that need to be converted to linked list.
+   * @return {LinkedList}
+   */
+  fromArray(values) {
+    values.forEach((value) => this.append(value));
+ 
+    return this;
+  }
+ 
+  /**
+   * @return {LinkedListNode[]}
+   */
+  toArray() {
+    const nodes = [];
+ 
+    let currentNode = this.head;
+    while (currentNode) {
+      nodes.push(currentNode);
+      currentNode = currentNode.next;
+    }
+ 
+    return nodes;
+  }
+ 
+  /**
+   * @param {function} [callback]
+   * @return {string}
+   */
+  toString(callback) {
+    return this.toArray().map((node) => node.toString(callback)).toString();
+  }
+ 
+  /**
+   * Reverse a linked list.
+   * @returns {LinkedList}
+   */
+  reverse() {
+    let currNode = this.head;
+    let prevNode = null;
+    let nextNode = null;
+ 
+    while (currNode) {
+      // Store next node.
+      nextNode = currNode.next;
+ 
+      // Change next node of the current node so it would link to previous node.
+      currNode.next = prevNode;
+ 
+      // Move prevNode and currNode nodes one step forward.
+      prevNode = currNode;
+      currNode = nextNode;
+    }
+ 
+    // Reset head and tail.
+    this.tail = this.head;
+    this.head = prevNode;
+ 
+    return this;
+  }
+}
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/data-structures/linked-list/LinkedListNode.js.html b/coverage/lcov-report/data-structures/linked-list/LinkedListNode.js.html new file mode 100644 index 00000000..ddfc6636 --- /dev/null +++ b/coverage/lcov-report/data-structures/linked-list/LinkedListNode.js.html @@ -0,0 +1,115 @@ + + + + + + Code coverage report for data-structures/linked-list/LinkedListNode.js + + + + + + + + + +
+
+

All files / data-structures/linked-list LinkedListNode.js

+
+ +
+ 100% + Statements + 3/3 +
+ + +
+ 100% + Branches + 3/3 +
+ + +
+ 100% + Functions + 2/2 +
+ + +
+ 100% + Lines + 3/3 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11  +  +176x +176x +  +  +  +70x +  +  + 
export default class LinkedListNode {
+  constructor(value, next = null) {
+    this.value = value;
+    this.next = next;
+  }
+ 
+  toString(callback) {
+    return callback ? callback(this.value) : `${this.value}`;
+  }
+}
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/data-structures/linked-list/index.html b/coverage/lcov-report/data-structures/linked-list/index.html new file mode 100644 index 00000000..335a6317 --- /dev/null +++ b/coverage/lcov-report/data-structures/linked-list/index.html @@ -0,0 +1,131 @@ + + + + + + Code coverage report for data-structures/linked-list + + + + + + + + + +
+
+

All files data-structures/linked-list

+
+ +
+ 100% + Statements + 87/87 +
+ + +
+ 100% + Branches + 37/37 +
+ + +
+ 100% + Functions + 15/15 +
+ + +
+ 100% + Lines + 85/85 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
LinkedList.js +
+
100%84/84100%34/34100%13/13100%82/82
LinkedListNode.js +
+
100%3/3100%3/3100%2/2100%3/3
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/favicon.png b/coverage/lcov-report/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..6691817834a957c938e7f09640a37a645fb31457 GIT binary patch literal 540 zcmV+%0^|LOP)wSzy{h>9elhJ=8GnBQmf?)AI(^#wDA_`!QTxaXXE&bjxo zTGCc%V|W`}Lwz0rDO*qBbGY-M@aNENIZ1rK?nOAibaC*vb%CF;I_~lkJawax%_+1J zLn(#pv_v{f0`v`Cfp6()7MB(>IoTAiQdKxgxX?VyV&KVZ7b$vn<8|Z<9$35C+G_8SH0x6Y(xB&~bmn%r}ceRwbc0000 + + + + Code coverage report for All files + + + + + + + + + +
+
+

All files

+
+ +
+ 100% + Statements + 337/337 +
+ + +
+ 98.4% + Branches + 123/125 +
+ + +
+ 100% + Functions + 100/100 +
+ + +
+ 100% + Lines + 330/330 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
algorithms/depth-first-search +
+
100%20/20100%11/11100%7/7100%20/20
algorithms/detect-cycle +
+
100%64/64100%12/12100%12/12100%62/62
data-structures/disjoint-set +
+
100%53/5396%24/25100%14/14100%53/53
data-structures/graph +
+
100%101/10196.66%29/30100%43/43100%99/99
data-structures/linked-list +
+
100%87/87100%37/37100%15/15100%85/85
utils/comparator +
+
100%12/12100%10/10100%9/9100%11/11
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/prettify.css b/coverage/lcov-report/prettify.css new file mode 100644 index 00000000..b317a7cd --- /dev/null +++ b/coverage/lcov-report/prettify.css @@ -0,0 +1 @@ +.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@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}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/coverage/lcov-report/prettify.js b/coverage/lcov-report/prettify.js new file mode 100644 index 00000000..b3225238 --- /dev/null +++ b/coverage/lcov-report/prettify.js @@ -0,0 +1,2 @@ +/* eslint-disable */ +window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"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"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"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"];var r="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";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="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";var I=[h,"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"];var f=[h,"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"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["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"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["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"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/coverage/lcov-report/sort-arrow-sprite.png b/coverage/lcov-report/sort-arrow-sprite.png new file mode 100644 index 0000000000000000000000000000000000000000..03f704a609c6fd0dbfdac63466a7d7c958b5cbf3 GIT binary patch literal 209 zcmeAS@N?(olHy`uVBq!ia0vp^>_9Bd!3HEZxJ@+%Qj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS>Jii$m5978H@?Fn+^JD|Y9yzj{W`447Gxa{7*dM7nnnD-Lb z6^}Hx2)'; + } + } + return cols; + } + // attaches a data attribute to every tr element with an object + // of data values keyed by column name + function loadRowData(tableRow) { + var tableCols = tableRow.querySelectorAll('td'), + colNode, + col, + data = {}, + i, + val; + for (i = 0; i < tableCols.length; i += 1) { + colNode = tableCols[i]; + col = cols[i]; + val = colNode.getAttribute('data-value'); + if (col.type === 'number') { + val = Number(val); + } + data[col.key] = val; + } + return data; + } + // loads all row data + function loadData() { + var rows = getTableBody().querySelectorAll('tr'), + i; + + for (i = 0; i < rows.length; i += 1) { + rows[i].data = loadRowData(rows[i]); + } + } + // sorts the table using the data for the ith column + function sortByIndex(index, desc) { + var key = cols[index].key, + sorter = function(a, b) { + a = a.data[key]; + b = b.data[key]; + return a < b ? -1 : a > b ? 1 : 0; + }, + finalSorter = sorter, + tableBody = document.querySelector('.coverage-summary tbody'), + rowNodes = tableBody.querySelectorAll('tr'), + rows = [], + i; + + if (desc) { + finalSorter = function(a, b) { + return -1 * sorter(a, b); + }; + } + + for (i = 0; i < rowNodes.length; i += 1) { + rows.push(rowNodes[i]); + tableBody.removeChild(rowNodes[i]); + } + + rows.sort(finalSorter); + + for (i = 0; i < rows.length; i += 1) { + tableBody.appendChild(rows[i]); + } + } + // removes sort indicators for current column being sorted + function removeSortIndicators() { + var col = getNthColumn(currentSort.index), + cls = col.className; + + cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); + col.className = cls; + } + // adds sort indicators for current column being sorted + function addSortIndicators() { + getNthColumn(currentSort.index).className += currentSort.desc + ? ' sorted-desc' + : ' sorted'; + } + // adds event listeners for all sorter widgets + function enableUI() { + var i, + el, + ithSorter = function ithSorter(i) { + var col = cols[i]; + + return function() { + var desc = col.defaultDescSort; + + if (currentSort.index === i) { + desc = !currentSort.desc; + } + sortByIndex(i, desc); + removeSortIndicators(); + currentSort.index = i; + currentSort.desc = desc; + addSortIndicators(); + }; + }; + for (i = 0; i < cols.length; i += 1) { + if (cols[i].sortable) { + // add the click event handler on the th so users + // dont have to click on those tiny arrows + el = getNthColumn(i).querySelector('.sorter').parentElement; + if (el.addEventListener) { + el.addEventListener('click', ithSorter(i)); + } else { + el.attachEvent('onclick', ithSorter(i)); + } + } + } + } + // adds sorting functionality to the UI + return function() { + if (!getTable()) { + return; + } + cols = loadColumns(); + loadData(); + addSearchBox(); + addSortIndicators(); + enableUI(); + }; +})(); + +window.addEventListener('load', addSorting); diff --git a/coverage/lcov-report/utils/comparator/Comparator.js.html b/coverage/lcov-report/utils/comparator/Comparator.js.html new file mode 100644 index 00000000..2027deb4 --- /dev/null +++ b/coverage/lcov-report/utils/comparator/Comparator.js.html @@ -0,0 +1,334 @@ + + + + + + Code coverage report for utils/comparator/Comparator.js + + + + + + + + + +
+
+

All files / utils/comparator Comparator.js

+
+ +
+ 100% + Statements + 12/12 +
+ + +
+ 100% + Branches + 10/10 +
+ + +
+ 100% + Functions + 9/9 +
+ + +
+ 100% + Lines + 11/11 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+

+
1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33 +34 +35 +36 +37 +38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 +55 +56 +57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 +68 +69 +70 +71 +72 +73 +74 +75 +76 +77 +78 +79 +80 +81 +82 +83 +84  +  +  +  +  +  +  +127x +  +  +  +  +  +  +  +  +  +57x +22x +  +  +35x +  +  +  +  +  +  +  +  +  +87x +  +  +  +  +  +  +  +  +  +10x +  +  +  +  +  +  +  +  +  +11x +  +  +  +  +  +  +  +  +  +3x +  +  +  +  +  +  +  +  +  +9x +  +  +  +  +  +  +1x +8x +  +  +  + 
export default class Comparator {
+  /**
+   * Constructor.
+   * @param {function(a: *, b: *)} [compareFunction] - It may be custom compare function that, let's
+   * say may compare custom objects together.
+   */
+  constructor(compareFunction) {
+    this.compare = compareFunction || Comparator.defaultCompareFunction;
+  }
+ 
+  /**
+   * Default comparison function. It just assumes that "a" and "b" are strings or numbers.
+   * @param {(string|number)} a
+   * @param {(string|number)} b
+   * @returns {number}
+   */
+  static defaultCompareFunction(a, b) {
+    if (a === b) {
+      return 0;
+    }
+ 
+    return a < b ? -1 : 1;
+  }
+ 
+  /**
+   * Checks if two variables are equal.
+   * @param {*} a
+   * @param {*} b
+   * @return {boolean}
+   */
+  equal(a, b) {
+    return this.compare(a, b) === 0;
+  }
+ 
+  /**
+   * Checks if variable "a" is less than "b".
+   * @param {*} a
+   * @param {*} b
+   * @return {boolean}
+   */
+  lessThan(a, b) {
+    return this.compare(a, b) < 0;
+  }
+ 
+  /**
+   * Checks if variable "a" is greater than "b".
+   * @param {*} a
+   * @param {*} b
+   * @return {boolean}
+   */
+  greaterThan(a, b) {
+    return this.compare(a, b) > 0;
+  }
+ 
+  /**
+   * Checks if variable "a" is less than or equal to "b".
+   * @param {*} a
+   * @param {*} b
+   * @return {boolean}
+   */
+  lessThanOrEqual(a, b) {
+    return this.lessThan(a, b) || this.equal(a, b);
+  }
+ 
+  /**
+   * Checks if variable "a" is greater than or equal to "b".
+   * @param {*} a
+   * @param {*} b
+   * @return {boolean}
+   */
+  greaterThanOrEqual(a, b) {
+    return this.greaterThan(a, b) || this.equal(a, b);
+  }
+ 
+  /**
+   * Reverses the comparison order.
+   */
+  reverse() {
+    const compareOriginal = this.compare;
+    this.compare = (a, b) => compareOriginal(b, a);
+  }
+}
+ 
+ 
+ +
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov-report/utils/comparator/index.html b/coverage/lcov-report/utils/comparator/index.html new file mode 100644 index 00000000..14efa823 --- /dev/null +++ b/coverage/lcov-report/utils/comparator/index.html @@ -0,0 +1,116 @@ + + + + + + Code coverage report for utils/comparator + + + + + + + + + +
+
+

All files utils/comparator

+
+ +
+ 100% + Statements + 12/12 +
+ + +
+ 100% + Branches + 10/10 +
+ + +
+ 100% + Functions + 9/9 +
+ + +
+ 100% + Lines + 11/11 +
+ + +
+

+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +

+ +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FileStatementsBranchesFunctionsLines
Comparator.js +
+
100%12/12100%10/10100%9/9100%11/11
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/coverage/lcov.info b/coverage/lcov.info new file mode 100644 index 00000000..6a6648c2 --- /dev/null +++ b/coverage/lcov.info @@ -0,0 +1,763 @@ +TN: +SF:src/algorithms/depth-first-search/depthFirstSearch.js +FN:17,initCallbacks +FN:20,(anonymous_1) +FN:23,(anonymous_2) +FN:25,(anonymous_3) +FN:48,depthFirstSearchRecursive +FN:51,(anonymous_5) +FN:65,depthFirstSearch +FNF:7 +FNH:7 +FNDA:9,initCallbacks +FNDA:27,(anonymous_1) +FNDA:9,(anonymous_2) +FNDA:16,(anonymous_3) +FNDA:47,depthFirstSearchRecursive +FNDA:63,(anonymous_5) +FNDA:9,depthFirstSearch +DA:18,9 +DA:20,9 +DA:22,9 +DA:24,9 +DA:25,9 +DA:26,16 +DA:27,12 +DA:28,12 +DA:30,4 +DA:35,9 +DA:36,9 +DA:37,9 +DA:39,9 +DA:49,47 +DA:51,47 +DA:52,63 +DA:53,38 +DA:57,47 +DA:66,9 +DA:67,9 +LF:20 +LH:20 +BRDA:17,0,0,1 +BRDA:26,1,0,12 +BRDA:26,1,1,4 +BRDA:35,2,0,9 +BRDA:35,2,1,2 +BRDA:36,3,0,9 +BRDA:36,3,1,1 +BRDA:37,4,0,9 +BRDA:37,4,1,3 +BRDA:52,5,0,38 +BRDA:52,5,1,25 +BRF:11 +BRH:11 +end_of_record +TN: +SF:src/algorithms/detect-cycle/detectDirectedCycle.js +FN:8,detectDirectedCycle +FN:32,(anonymous_1) +FN:38,(anonymous_2) +FN:63,(anonymous_3) +FN:69,(anonymous_4) +FNF:5 +FNH:5 +FNDA:2,detectDirectedCycle +FNDA:12,(anonymous_1) +FNDA:13,(anonymous_2) +FNDA:13,(anonymous_3) +FNDA:15,(anonymous_4) +DA:9,2 +DA:13,2 +DA:16,2 +DA:20,2 +DA:24,2 +DA:32,2 +DA:33,12 +DA:37,2 +DA:39,13 +DA:42,1 +DA:44,1 +DA:45,1 +DA:47,1 +DA:48,2 +DA:49,2 +DA:50,2 +DA:53,1 +DA:56,12 +DA:57,12 +DA:60,12 +DA:66,13 +DA:67,13 +DA:72,15 +DA:73,2 +DA:78,13 +DA:83,2 +DA:85,4 +DA:86,4 +DA:89,4 +DA:92,2 +LF:30 +LH:30 +BRDA:39,0,0,1 +BRDA:39,0,1,12 +BRDA:72,1,0,2 +BRDA:72,1,1,13 +BRF:4 +BRH:4 +end_of_record +TN: +SF:src/algorithms/detect-cycle/detectUndirectedCycle.js +FN:8,detectUndirectedCycle +FN:19,(anonymous_1) +FN:31,(anonymous_2) +FNF:3 +FNH:3 +FNDA:2,detectUndirectedCycle +FNDA:25,(anonymous_1) +FNDA:13,(anonymous_2) +DA:9,2 +DA:12,2 +DA:15,2 +DA:18,2 +DA:21,25 +DA:22,6 +DA:26,19 +DA:27,19 +DA:29,19 +DA:32,13 +DA:34,1 +DA:36,1 +DA:37,1 +DA:39,1 +DA:40,3 +DA:41,3 +DA:42,3 +DA:45,1 +DA:48,12 +DA:49,12 +DA:55,2 +DA:56,2 +DA:58,2 +LF:23 +LH:23 +BRDA:21,0,0,6 +BRDA:21,0,1,19 +BRDA:27,1,0,15 +BRDA:27,1,1,4 +BRDA:32,2,0,1 +BRDA:32,2,1,12 +BRF:6 +BRH:6 +end_of_record +TN: +SF:src/algorithms/detect-cycle/detectUndirectedCycleUsingDisjointSet.js +FN:8,detectUndirectedCycleUsingDisjointSet +FN:11,(anonymous_1) +FN:13,(anonymous_2) +FN:21,(anonymous_3) +FNF:4 +FNH:4 +FNDA:2,detectUndirectedCycleUsingDisjointSet +FNDA:118,(anonymous_1) +FNDA:12,(anonymous_2) +FNDA:11,(anonymous_3) +DA:11,118 +DA:12,2 +DA:13,12 +DA:19,2 +DA:21,2 +DA:22,11 +DA:24,1 +DA:26,10 +DA:30,2 +LF:9 +LH:9 +BRDA:22,0,0,1 +BRDA:22,0,1,10 +BRF:2 +BRH:2 +end_of_record +TN: +SF:src/data-structures/disjoint-set/DisjointSet.js +FN:7,(anonymous_0) +FN:16,(anonymous_1) +FN:33,(anonymous_2) +FN:53,(anonymous_3) +FN:87,(anonymous_4) +FNF:5 +FNH:5 +FNDA:7,(anonymous_0) +FNDA:26,(anonymous_1) +FNDA:128,(anonymous_2) +FNDA:23,(anonymous_3) +FNDA:29,(anonymous_4) +DA:8,7 +DA:9,7 +DA:17,26 +DA:19,26 +DA:21,26 +DA:24,26 +DA:34,128 +DA:37,128 +DA:39,128 +DA:40,10 +DA:43,118 +DA:54,23 +DA:55,23 +DA:57,23 +DA:58,1 +DA:61,22 +DA:63,1 +DA:66,21 +DA:67,21 +DA:69,21 +DA:71,1 +DA:73,1 +DA:77,20 +DA:79,20 +DA:88,29 +DA:89,29 +DA:91,29 +DA:92,1 +DA:95,28 +LF:29 +LH:29 +BRDA:19,0,0,26 +BRDA:19,0,1,0 +BRDA:39,1,0,10 +BRDA:39,1,1,118 +BRDA:57,2,0,1 +BRDA:57,2,1,22 +BRDA:57,3,0,23 +BRDA:57,3,1,22 +BRDA:61,4,0,1 +BRDA:61,4,1,21 +BRDA:69,5,0,1 +BRDA:69,5,1,20 +BRDA:91,6,0,1 +BRDA:91,6,1,28 +BRDA:91,7,0,29 +BRDA:91,7,1,28 +BRF:16 +BRH:15 +end_of_record +TN: +SF:src/data-structures/disjoint-set/DisjointSetItem.js +FN:6,(anonymous_0) +FN:17,(anonymous_1) +FN:30,(anonymous_2) +FN:37,(anonymous_3) +FN:46,(anonymous_4) +FN:54,(anonymous_5) +FN:68,(anonymous_6) +FN:77,(anonymous_7) +FN:90,(anonymous_8) +FNF:9 +FNH:9 +FNDA:162,(anonymous_0) +FNDA:327,(anonymous_1) +FNDA:177,(anonymous_2) +FNDA:197,(anonymous_3) +FNDA:105,(anonymous_4) +FNDA:47,(anonymous_5) +FNDA:145,(anonymous_6) +FNDA:29,(anonymous_7) +FNDA:27,(anonymous_8) +DA:7,162 +DA:8,162 +DA:10,162 +DA:11,162 +DA:19,327 +DA:20,185 +DA:24,142 +DA:31,177 +DA:38,197 +DA:47,105 +DA:48,79 +DA:51,26 +DA:54,26 +DA:56,47 +DA:59,47 +DA:62,26 +DA:69,145 +DA:78,29 +DA:79,29 +DA:80,2 +DA:83,29 +DA:91,27 +DA:92,27 +DA:94,27 +LF:24 +LH:24 +BRDA:19,0,0,185 +BRDA:19,0,1,142 +BRDA:31,1,0,128 +BRDA:31,1,1,49 +BRDA:47,2,0,79 +BRDA:47,2,1,26 +BRDA:77,3,0,2 +BRDA:79,4,0,2 +BRDA:79,4,1,27 +BRF:9 +BRH:9 +end_of_record +TN: +SF:src/data-structures/graph/Graph.js +FN:5,(anonymous_0) +FN:15,(anonymous_1) +FN:24,(anonymous_2) +FN:32,(anonymous_3) +FN:39,(anonymous_4) +FN:46,(anonymous_5) +FN:54,(anonymous_6) +FN:94,(anonymous_7) +FN:115,(anonymous_8) +FN:128,(anonymous_9) +FN:129,(anonymous_10) +FN:138,(anonymous_11) +FN:140,(anonymous_12) +FN:157,(anonymous_13) +FN:159,(anonymous_14) +FN:169,(anonymous_15) +FN:175,(anonymous_16) +FN:180,(anonymous_17) +FN:181,(anonymous_18) +FN:193,(anonymous_19) +FNF:20 +FNH:20 +FNDA:21,(anonymous_0) +FNDA:79,(anonymous_1) +FNDA:262,(anonymous_2) +FNDA:62,(anonymous_3) +FNDA:48,(anonymous_4) +FNDA:12,(anonymous_5) +FNDA:75,(anonymous_6) +FNDA:5,(anonymous_7) +FNDA:20,(anonymous_8) +FNDA:2,(anonymous_9) +FNDA:8,(anonymous_10) +FNDA:1,(anonymous_11) +FNDA:3,(anonymous_12) +FNDA:3,(anonymous_13) +FNDA:12,(anonymous_14) +FNDA:2,(anonymous_15) +FNDA:8,(anonymous_16) +FNDA:8,(anonymous_17) +FNDA:12,(anonymous_18) +FNDA:7,(anonymous_19) +DA:6,21 +DA:7,21 +DA:8,21 +DA:16,79 +DA:17,79 +DA:25,262 +DA:33,62 +DA:40,48 +DA:47,12 +DA:56,75 +DA:57,75 +DA:60,75 +DA:61,21 +DA:62,21 +DA:66,75 +DA:67,56 +DA:68,56 +DA:72,75 +DA:73,1 +DA:75,74 +DA:79,74 +DA:81,40 +DA:84,34 +DA:85,34 +DA:88,74 +DA:96,5 +DA:97,4 +DA:99,1 +DA:103,4 +DA:104,4 +DA:106,4 +DA:107,4 +DA:116,20 +DA:118,20 +DA:119,2 +DA:122,18 +DA:129,2 +DA:130,8 +DA:140,1 +DA:142,3 +DA:145,3 +DA:148,3 +DA:151,1 +DA:158,3 +DA:159,3 +DA:160,12 +DA:163,3 +DA:170,2 +DA:171,2 +DA:175,2 +DA:176,8 +DA:180,2 +DA:181,8 +DA:182,12 +DA:183,12 +DA:187,2 +DA:194,7 +LF:57 +LH:57 +BRDA:5,0,0,11 +BRDA:60,1,0,21 +BRDA:60,1,1,54 +BRDA:66,2,0,56 +BRDA:66,2,1,19 +BRDA:72,3,0,1 +BRDA:72,3,1,74 +BRDA:79,4,0,40 +BRDA:79,4,1,34 +BRDA:96,5,0,4 +BRDA:96,5,1,1 +BRDA:118,6,0,2 +BRDA:118,6,1,18 +BRF:13 +BRH:13 +end_of_record +TN: +SF:src/data-structures/graph/GraphEdge.js +FN:7,(anonymous_0) +FN:16,(anonymous_1) +FN:26,(anonymous_2) +FN:37,(anonymous_3) +FNF:4 +FNH:4 +FNDA:88,(anonymous_0) +FNDA:248,(anonymous_1) +FNDA:4,(anonymous_2) +FNDA:5,(anonymous_3) +DA:8,88 +DA:9,88 +DA:10,88 +DA:17,248 +DA:18,248 +DA:20,248 +DA:27,4 +DA:28,4 +DA:29,4 +DA:31,4 +DA:38,5 +LF:11 +LH:11 +BRDA:7,0,0,76 +BRF:1 +BRH:1 +end_of_record +TN: +SF:src/data-structures/graph/GraphVertex.js +FN:7,(anonymous_0) +FN:16,(anonymous_1) +FN:34,(anonymous_2) +FN:43,(anonymous_3) +FN:50,(anonymous_4) +FN:54,(anonymous_5) +FN:66,(anonymous_6) +FN:67,(anonymous_7) +FN:73,(anonymous_8) +FN:81,(anonymous_9) +FN:83,(anonymous_10) +FN:93,(anonymous_11) +FN:95,(anonymous_12) +FN:105,(anonymous_13) +FN:106,(anonymous_14) +FN:118,(anonymous_15) +FN:125,(anonymous_16) +FN:126,(anonymous_17) +FN:135,(anonymous_18) +FNF:19 +FNH:19 +FNDA:112,(anonymous_0) +FNDA:26,(anonymous_1) +FNDA:122,(anonymous_2) +FNDA:12,(anonymous_3) +FNDA:84,(anonymous_4) +FNDA:104,(anonymous_5) +FNDA:12,(anonymous_6) +FNDA:16,(anonymous_7) +FNDA:4,(anonymous_8) +FNDA:18,(anonymous_9) +FNDA:9,(anonymous_10) +FNDA:2,(anonymous_11) +FNDA:2,(anonymous_12) +FNDA:20,(anonymous_13) +FNDA:25,(anonymous_14) +FNDA:1235,(anonymous_15) +FNDA:1,(anonymous_16) +FNDA:2,(anonymous_17) +FNDA:1,(anonymous_18) +DA:8,112 +DA:9,1 +DA:16,111 +DA:17,26 +DA:18,12 +DA:21,14 +DA:26,111 +DA:27,111 +DA:35,122 +DA:37,122 +DA:44,12 +DA:51,84 +DA:54,84 +DA:55,104 +DA:60,84 +DA:67,16 +DA:74,4 +DA:82,18 +DA:83,9 +DA:86,18 +DA:94,2 +DA:95,2 +DA:98,2 +DA:106,20 +DA:107,25 +DA:110,20 +DA:112,20 +DA:119,1235 +DA:126,2 +DA:128,1 +DA:136,1 +LF:31 +LH:31 +BRDA:8,0,0,1 +BRDA:8,0,1,111 +BRDA:17,1,0,12 +BRDA:17,1,1,14 +BRDA:21,2,0,2 +BRDA:21,2,1,12 +BRDA:55,3,0,83 +BRDA:55,3,1,21 +BRDA:95,4,0,2 +BRDA:95,4,1,2 +BRDA:107,5,0,25 +BRDA:107,5,1,20 +BRDA:112,6,0,16 +BRDA:112,6,1,4 +BRDA:136,7,0,0 +BRDA:136,7,1,1 +BRF:16 +BRH:15 +end_of_record +TN: +SF:src/data-structures/linked-list/LinkedList.js +FN:8,(anonymous_0) +FN:22,(anonymous_1) +FN:39,(anonymous_2) +FN:61,(anonymous_3) +FN:103,(anonymous_4) +FN:130,(anonymous_5) +FN:161,(anonymous_6) +FN:182,(anonymous_7) +FN:183,(anonymous_8) +FN:191,(anonymous_9) +FN:207,(anonymous_10) +FN:208,(anonymous_11) +FN:215,(anonymous_12) +FNF:13 +FNH:13 +FNDA:125,(anonymous_0) +FNDA:3,(anonymous_1) +FNDA:167,(anonymous_2) +FNDA:19,(anonymous_3) +FNDA:50,(anonymous_4) +FNDA:3,(anonymous_5) +FNDA:3,(anonymous_6) +FNDA:2,(anonymous_7) +FNDA:13,(anonymous_8) +FNDA:121,(anonymous_9) +FNDA:20,(anonymous_10) +FNDA:44,(anonymous_11) +FNDA:2,(anonymous_12) +DA:10,125 +DA:13,125 +DA:15,125 +DA:24,3 +DA:25,3 +DA:28,3 +DA:29,1 +DA:32,3 +DA:40,167 +DA:43,167 +DA:44,87 +DA:45,87 +DA:47,87 +DA:51,80 +DA:52,80 +DA:54,80 +DA:62,19 +DA:63,3 +DA:66,16 +DA:70,16 +DA:71,12 +DA:72,12 +DA:75,16 +DA:77,16 +DA:79,12 +DA:80,16 +DA:81,5 +DA:82,5 +DA:84,11 +DA:90,16 +DA:91,6 +DA:94,16 +DA:104,50 +DA:105,13 +DA:108,37 +DA:110,37 +DA:112,57 +DA:113,25 +DA:117,32 +DA:118,4 +DA:121,28 +DA:124,8 +DA:131,3 +DA:133,3 +DA:135,1 +DA:136,1 +DA:138,1 +DA:144,2 +DA:145,2 +DA:146,3 +DA:147,2 +DA:149,1 +DA:153,2 +DA:155,2 +DA:162,3 +DA:163,1 +DA:166,2 +DA:168,2 +DA:169,1 +DA:171,1 +DA:172,1 +DA:175,2 +DA:183,13 +DA:185,2 +DA:192,121 +DA:194,121 +DA:195,121 +DA:196,173 +DA:197,173 +DA:200,121 +DA:208,44 +DA:216,2 +DA:217,2 +DA:218,2 +DA:220,2 +DA:222,6 +DA:225,6 +DA:228,6 +DA:229,6 +DA:233,2 +DA:234,2 +DA:236,2 +LF:82 +LH:82 +BRDA:28,0,0,1 +BRDA:28,0,1,2 +BRDA:43,1,0,87 +BRDA:43,1,1,80 +BRDA:62,2,0,3 +BRDA:62,2,1,16 +BRDA:70,3,0,28 +BRDA:70,3,1,24 +BRDA:77,4,0,12 +BRDA:77,4,1,4 +BRDA:80,5,0,5 +BRDA:80,5,1,11 +BRDA:90,6,0,6 +BRDA:90,6,1,10 +BRDA:103,7,0,43 +BRDA:103,8,0,7 +BRDA:104,9,0,13 +BRDA:104,9,1,37 +BRDA:112,10,0,25 +BRDA:112,10,1,32 +BRDA:112,11,0,57 +BRDA:112,11,1,42 +BRDA:117,12,0,4 +BRDA:117,12,1,28 +BRDA:117,13,0,32 +BRDA:117,13,1,15 +BRDA:133,14,0,1 +BRDA:133,14,1,2 +BRDA:146,15,0,2 +BRDA:146,15,1,1 +BRDA:162,16,0,1 +BRDA:162,16,1,2 +BRDA:168,17,0,1 +BRDA:168,17,1,1 +BRF:34 +BRH:34 +end_of_record +TN: +SF:src/data-structures/linked-list/LinkedListNode.js +FN:2,(anonymous_0) +FN:7,(anonymous_1) +FNF:2 +FNH:2 +FNDA:176,(anonymous_0) +FNDA:70,(anonymous_1) +DA:3,176 +DA:4,176 +DA:8,70 +LF:3 +LH:3 +BRDA:2,0,0,172 +BRDA:8,1,0,3 +BRDA:8,1,1,67 +BRF:3 +BRH:3 +end_of_record +TN: +SF:src/utils/comparator/Comparator.js +FN:7,(anonymous_0) +FN:17,(anonymous_1) +FN:31,(anonymous_2) +FN:41,(anonymous_3) +FN:51,(anonymous_4) +FN:61,(anonymous_5) +FN:71,(anonymous_6) +FN:78,(anonymous_7) +FN:80,(anonymous_8) +FNF:9 +FNH:9 +FNDA:127,(anonymous_0) +FNDA:57,(anonymous_1) +FNDA:87,(anonymous_2) +FNDA:10,(anonymous_3) +FNDA:11,(anonymous_4) +FNDA:3,(anonymous_5) +FNDA:9,(anonymous_6) +FNDA:1,(anonymous_7) +FNDA:8,(anonymous_8) +DA:8,127 +DA:18,57 +DA:19,22 +DA:22,35 +DA:32,87 +DA:42,10 +DA:52,11 +DA:62,3 +DA:72,9 +DA:79,1 +DA:80,8 +LF:11 +LH:11 +BRDA:8,0,0,127 +BRDA:8,0,1,13 +BRDA:18,1,0,22 +BRDA:18,1,1,35 +BRDA:22,2,0,20 +BRDA:22,2,1,15 +BRDA:62,3,0,3 +BRDA:62,3,1,3 +BRDA:72,4,0,9 +BRDA:72,4,1,6 +BRF:10 +BRH:10 +end_of_record diff --git a/package.json b/package.json index 55bb296a..949c35f7 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,6 @@ "test": "jest", "coverage": "npm run test -- --coverage", "lint": "eslint ./src/**", - " ": "npm run test -- --coverage", "ci": "npm run lint && npm run coverage", "prepare": "husky install" }, diff --git a/src/data-structures/graph/Graph.js b/src/data-structures/graph/Graph.js index f62e64bb..34333fbf 100644 --- a/src/data-structures/graph/Graph.js +++ b/src/data-structures/graph/Graph.js @@ -191,6 +191,7 @@ export default class Graph { * @return {string} */ toString() { - return Object.keys(this.vertices).toString(); + return {'edges': Object.keys(this.edges).toString(), + 'vertices': Object.keys(this.vertices).toString()}; } } diff --git a/src/server.js b/src/server.js index 3f5bee07..8d107cb7 100644 --- a/src/server.js +++ b/src/server.js @@ -37,27 +37,26 @@ app.get('/', (req, res) => { let AB = new GraphEdge(A, B); let AC = new GraphEdge(A, C); let AD = new GraphEdge(A, D); - - A.addEdge(AB); - A.addEdge(AC); - A.addEdge(AD); - let BD = new GraphEdge(B, D); - - B.addEdge(BD); - let CA = new GraphEdge(C, A); let CB = new GraphEdge(C, B); - C.addEdge(CA); - C.addEdge(CB); - graph_.addVertex(A); graph_.addVertex(B); graph_.addVertex(C); graph_.addVertex(D); - + graph_ + .addEdge(AB) + .addEdge(AC) + .addEdge(AD) + .addEdge(BD) + .addEdge(CA) + .addEdge(CB); + + console.log(graph_.getAllEdges()); + console.log(graph_.getAllVertices()); + res.send(graph_.toString()); /* // arbitrary source @@ -91,7 +90,6 @@ app.get('/', (req, res) => { } } */ - res.send(graph_.toString()); }); // [END app]