public virtual void Set(IGraphMatrix other) { NodesNr = other.NodesNr; connect = new int[NodesNr, NodesNr]; weights = new int[NodesNr, NodesNr]; for (int y = 0; y < NodesNr; ++y) { for (int x = 0; x < NodesNr; ++x) { if (other.GetConnection(x, y)) { MakeConnection(x, y); int weight = other.getWeight(x, y); setWeight(x, y, weight); } } } Columns = other.Columns; }
public bool Equals(IGraphMatrix other) { if (other == null) { return(false); } if (this.NodesNr != other.NodesNr) { return(false); } for (int i = 0; i < nodesNr; i++) { for (int j = 0; j < nodesNr; j++) { if (this.GetConnection(i, j) != other.GetConnection(i, j)) { return(false); } } } return(true); }