Skip to content

Commit

Permalink
- Added the isNeighbourOf example.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Coallier committed Nov 6, 2010
1 parent 0c4c55d commit 9b18187
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions examples/isNeighbourOf.js
@@ -0,0 +1,19 @@
var sys = require('sys');
var edge = require('../lib/edge');
var graph = require('../lib/graph');
var vertex = require('../lib/vertex');

var Graph = new graph.Graph();
var VertexOne = new vertex.Vertex('nameOne', {});
var VertexTwo = new vertex.Vertex('nameTwo', {});
var VertexThree = new vertex.Vertex('nameThree', {});

Graph.addVertex(VertexOne);
Graph.addVertex(VertexTwo);
Graph.addVertex(VertexThree);

Graph.addEdge(new edge.Edge('nameOne', 'nameTwo', {}));
Graph.addEdge(new edge.Edge('nameOne', 'nameThree', {}));

var verts = Graph.getVertices();
sys.puts(sys.inspect(VertexTwo.isNeighbourOf('nameOnex')));

0 comments on commit 9b18187

Please sign in to comment.