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

@@ -91,7 +91,7 @@ DFSAlgorithm.prototype.dfs = 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);
@@ -103,6 +103,12 @@ DFSAlgorithm.prototype.dfs = function(vertex, vertexArray, edgeArray)
return false;
}
// Algorithm support multi graph
DFSAlgorithm.prototype.IsSupportMultiGraph = function()
{
return true;
}
// Factory for connected components.
function CreateDFSAlgorithm(graph, app)
{