Add multigraph support. Visualization and some algorithms.

This commit is contained in:
Unick Soft
2019-10-05 16:11:40 +02:00
parent c580c5aef9
commit 063c2f9ec0
21 changed files with 367 additions and 85 deletions

View File

@@ -92,7 +92,7 @@ BFSAlgorithm.prototype.bfs = function(vertex, vertexArray, edgeArray)
for (var i = 0; i < this.graph.vertices.length; i ++)
{
var nextVertex = this.graph.vertices[i];
var edge = this.graph.FindEdge(vertex.id, nextVertex.id);
var edge = this.graph.FindEdgeAny(vertex.id, nextVertex.id);
if (edge && !vertexArray.includes(nextVertex))
{
edgeArray.push(edge);
@@ -104,6 +104,12 @@ BFSAlgorithm.prototype.bfs = function(vertex, vertexArray, edgeArray)
return false;
}
// Algorithm support multi graph
BFSAlgorithm.prototype.IsSupportMultiGraph = function()
{
return true;
}
// Factory for connected components.
function CreateBFSAlgorithm(graph, app)
{