diff --git a/src/server.js b/src/server.js
index 8d107cb7..c1566b81 100644
--- a/src/server.js
+++ b/src/server.js
@@ -5,6 +5,7 @@ import express from 'express'
import Graph from './data-structures/graph/Graph.js'
import GraphVertex from './data-structures/graph/GraphVertex.js'
import GraphEdge from './data-structures/graph/GraphEdge.js'
+import depthFirstSearch from './algorithms/depth-first-search/depthFirstSearch.js'
const app = express();
@@ -25,6 +26,7 @@ app.get('/', (req, res) => {
// Create a sample graph
// const graph = req.blueprint.nodes;
+ // A directed graph
let graph_ = new Graph(true);
// Nodes
@@ -41,11 +43,14 @@ app.get('/', (req, res) => {
let CA = new GraphEdge(C, A);
let CB = new GraphEdge(C, B);
- graph_.addVertex(A);
- graph_.addVertex(B);
- graph_.addVertex(C);
- graph_.addVertex(D);
+ // Add vertices
+ graph_
+ .addVertex(A)
+ .addVertex(B)
+ .addVertex(C)
+ .addVertex(D);
+ // Add edges
graph_
.addEdge(AB)
.addEdge(AC)
@@ -54,42 +59,7 @@ app.get('/', (req, res) => {
.addEdge(CA)
.addEdge(CB);
- console.log(graph_.getAllEdges());
- console.log(graph_.getAllVertices());
res.send(graph_.toString());
-
- /*
- // arbitrary source
- let from_ = 1;
-
- // arbitrary destination
- let to = 3;
-
- let all_paths = s.allPaths(from_, to);
- let all_vicinity = s.allVicinity();
- let loose_nodes = s.looseNodes();
-
- console.log('Paths from '+from_+' to '+to+' :');
- console.log(all_paths);
-
- console.log('Reachibility: ');
- console.log(all_vicinity);
-
- console.log('Loose nodes: ');
- console.log(loose_nodes);
-
- let text_ = "Original code from the URL : Graph paths original post " + "
";
-
- if(all_paths.length==0){
- text_ = text_ + 'There is no path available from ' + from_ + ' to ' + to + '!';
- } else {
- text_ = text_ + "Following are all different paths from " + from_ + " to " + to + "
";
-
- for (let i=0; i";
- }
- }
- */
});
// [END app]