/// <summary> /// Creates connection between two points /// </summary> /// <param name="from">The point, where the connections starts</param> /// <param name="to">The point, where the connection ends</param> void ConnectPoints(CandidatePoint from, CandidatePoint to) { CandidatesConnection c = new CandidatesConnection() { From = from, To = to }; from.OutgoingConnections.Add(c); to.IncomingConnections.Add(c); }
/// <summary> /// Calculates transmission probability for connection /// </summary> /// <param name="c">Connection</param> /// <returns>double value representing transmission probability</returns> double CalculateTransmissionProbability(CandidatesConnection c) { double gcd = Calculations.GetDistance2D(c.From.MapPoint, c.To.MapPoint); double shortestPath = FindShortestPath(c.From, c.To); if (gcd == 0 && shortestPath == 0) { return(1); } else { return(gcd / shortestPath); } }