// TODO con quale timestamp si calcola? public void ComputeProximityCorrelation() { DateTime fromDate = new DateTime(); DateTime toDate = new DateTime(); if (fromNode is FuzzyNodeCluster) { FuzzyNodeCluster fcn = (FuzzyNodeCluster)fromNode; DateTime max = new DateTime(); foreach (FuzzyNode fn in fcn.GetNodesInCluster()) { if (Convert.ToDateTime(fn.GetAttributes()["time:timestamp"][0]) > max) { max = Convert.ToDateTime(fn.GetAttributes()["time:timestamp"][0]); } } fromDate = max; } else { fromDate = Convert.ToDateTime(fromNode.GetAttributes()["time:timestamp"][0]); } if (toNode is FuzzyNodeCluster) { FuzzyNodeCluster fcn = (FuzzyNodeCluster)toNode; DateTime min = new DateTime(); foreach (FuzzyNode fn in fcn.GetNodesInCluster()) { if (Convert.ToDateTime(fn.GetAttributes()["time:timestamp"][0]) < min) { min = Convert.ToDateTime(fn.GetAttributes()["time:timestamp"][0]); } } fromDate = min; } else { toDate = Convert.ToDateTime(toNode.GetAttributes()["time:timestamp"][0]); } if ((fromDate != null) && (toDate != null)) { long timeFrom = fromDate.Ticks; long timeTo = toDate.Ticks; if (timeFrom != timeTo) { proximityCorrelation = (1 / (timeFrom - timeTo)); } else { proximityCorrelation = 1; } } else { proximityCorrelation = 0; } }
public FuzzyEdge(FuzzyNode from, FuzzyNode to) { this.fromNode = from; this.toNode = to; this.durationsList = new List <double>(); ComputeEndpointCorrelation(); if (fromNode.GetAttributes().Keys.Contains <string>("time:timestamp") && toNode.GetAttributes().Keys.Contains <string>("time:timestamp")) { ComputeProximityCorrelation(); } if (fromNode.GetAttributes().Keys.Contains <string>("org:resource") && toNode.GetAttributes().Keys.Contains <string>("org:resource")) { ComputeOriginatorCorrelation(); } }