public double?GetActivationValueOfVertex(int bookId) { VertexBook book = GetVertex(bookId); if (book == null) { return(null); } return(book.GetActivationValue()); }
public void printTopKOfGraph(int numberOfVertices) { List <VertexBook> topKVertices = this.bookIdsDictionary.Values .OrderBy(v => v.GetActivationValue()).Reverse().Take(numberOfVertices).ToList(); for (int i = 0; i < topKVertices.Count(); i++) { VertexBook vertexI = topKVertices[i]; System.Console.WriteLine("Book " + i + " : " + vertexI.GetBookID() + " " + vertexI.GetActivationValue()); } }
public void AddVertex(int bookId, double activationValue) { if (GetVertex(bookId) != null) { throw new System.ArgumentException("Parameter cannot be ", "" + bookId); } VertexBook vertexBook = new VertexBook(bookId, activationValue); this.bookIdsDictionary.Add(bookId, vertexBook); }
public void IncreaseActivationValueOfVertex(int bookId, double increaseAmount) { VertexBook vertex = GetVertex(bookId); if (vertex == null) { AddVertex(bookId, increaseAmount); } else { vertex.SetActivationValue( vertex.GetActivationValue() + increaseAmount); } }