public void AddEdge(VertexOfTable tableFrom, VertexOfTable tableTo, int id) { AddVertexIfNonExist(tableFrom); AddVertexIfNonExist(tableTo); var edge = new Edge(_idDictionary[tableFrom.GetName()], _idDictionary[tableTo.GetName()], id); AddEdge(edge); }
public int GetIdOfVertex(VertexOfTable vertex) { var name = vertex.GetName(); if (_idDictionary.ContainsKey(name)) { return(_idDictionary[name]); } else { return(-1); } }
public void AddVertexIfNonExist(VertexOfTable vertex) { var nameOfTable = vertex.GetName(); if (_idDictionary.ContainsKey(nameOfTable)) { return; } _idDictionary[nameOfTable] = _countVertex; _nameOfId[_idDictionary[nameOfTable]] = nameOfTable; _graph.Add(new List <Edge>()); _nodes.Add(vertex); _countVertex++; }