mirror of
https://github.com/UnickSoft/graphonline.git
synced 2026-04-08 08:46:03 +00:00
Fix search Eulerian path/loop if graph has separate nodes.
This commit is contained in:
@@ -99,6 +99,26 @@ Graph.prototype.DeleteVertex = function(vertexObject)
|
||||
}
|
||||
}
|
||||
|
||||
Graph.prototype.HasConnectedNodes = function(vertexObject)
|
||||
{
|
||||
var res = false;
|
||||
|
||||
var index = this.vertices.indexOf(vertexObject);
|
||||
if (index > -1)
|
||||
{
|
||||
for (var i = 0; i < this.edges.length; i++)
|
||||
{
|
||||
if (this.edges[i].vertex1 == vertexObject || this.edges[i].vertex2 == vertexObject)
|
||||
{
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
Graph.prototype.FindVertex = function(id)
|
||||
{
|
||||
var res = null;
|
||||
|
||||
Reference in New Issue
Block a user