mirror of
https://github.com/UnickSoft/graphonline.git
synced 2025-07-03 00:06:40 +00:00
Fix change adj matrix and remove vertex.
This commit is contained in:
parent
9ffa9f0571
commit
1dea43bbcf
@ -678,7 +678,7 @@ Application.prototype.TestAdjacencyMatrix = function (matrix, rowsObj, colsObj,
|
|||||||
Application.prototype.SetAdjacencyMatrix = function (matrix, separator = ",")
|
Application.prototype.SetAdjacencyMatrix = function (matrix, separator = ",")
|
||||||
{
|
{
|
||||||
var res = true;
|
var res = true;
|
||||||
var r = {};
|
var r = {};
|
||||||
var c = {};
|
var c = {};
|
||||||
if (!this.TestAdjacencyMatrix(matrix, r, c, separator))
|
if (!this.TestAdjacencyMatrix(matrix, r, c, separator))
|
||||||
{
|
{
|
||||||
|
@ -105,11 +105,13 @@ Graph.prototype.DeleteVertex = function(vertexObject)
|
|||||||
var index = this.vertices.indexOf(vertexObject);
|
var index = this.vertices.indexOf(vertexObject);
|
||||||
if (index > -1)
|
if (index > -1)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < this.edges.length; i++)
|
var clonedEdge = this.edges.slice(0);
|
||||||
|
|
||||||
|
for (var i = 0; i < clonedEdge.length; i++)
|
||||||
{
|
{
|
||||||
if (this.edges[i].vertex1 == vertexObject || this.edges[i].vertex2 == vertexObject)
|
if (clonedEdge[i].vertex1 == vertexObject || clonedEdge[i].vertex2 == vertexObject)
|
||||||
{
|
{
|
||||||
this.DeleteEdge(this.edges[i]);
|
this.DeleteEdge(clonedEdge[i]);
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -461,9 +463,11 @@ Graph.prototype.SetAdjacencyMatrix = function (matrix, viewportSize, currentEnum
|
|||||||
{
|
{
|
||||||
rows = rowsObj.rows;
|
rows = rowsObj.rows;
|
||||||
cols = colsObj.cols;
|
cols = colsObj.cols;
|
||||||
for (var i = 0; i < this.edges.length; i++)
|
|
||||||
|
var clonedEdge = this.edges.slice(0);
|
||||||
|
for (var i = 0; i < clonedEdge.length; i++)
|
||||||
{
|
{
|
||||||
this.DeleteEdge (this.edges[i]);
|
this.DeleteEdge (clonedEdge[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
var newVertexes = [];
|
var newVertexes = [];
|
||||||
@ -581,9 +585,10 @@ Graph.prototype.SetIncidenceMatrix = function (matrix, viewportSize, currentEnum
|
|||||||
{
|
{
|
||||||
rows = rowsObj.rows;
|
rows = rowsObj.rows;
|
||||||
cols = colsObj.cols;
|
cols = colsObj.cols;
|
||||||
for (var i = 0; i < this.edges.length; i++)
|
var clonedEdge = this.edges.slice(0);
|
||||||
|
for (var i = 0; i < clonedEdge.length; i++)
|
||||||
{
|
{
|
||||||
this.DeleteEdge (this.edges[i]);
|
this.DeleteEdge (clonedEdge[i]);
|
||||||
}
|
}
|
||||||
var newVertexes = [];
|
var newVertexes = [];
|
||||||
var bWeightGraph = false;
|
var bWeightGraph = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user