public EdgeInfo(EdgeInfo edge) { //Weight = edge.Weight; TweetWeight = edge.TweetWeight; UserWeight = edge.UserWeight; //Users = new Hashtable(); ////deep copy //foreach(object key in edge.Users.Keys) //{ // Users.Add(key, Users[key]); //} }
public void AddNodes(Tweet tweet) { int nodeKeyIndex; Hashtable edgeList; List <NodeInfo> newNodesList = new List <NodeInfo>(); foreach (string node in tweet.TweetWords) { newNodesList.Add(new NodeInfo(node, 1)); } Union(_NodeList, newNodesList); List <int> nodeIndexList = GetIndexesNodeList(tweet.TweetWords); UpdateUserInfo(tweet.UserName, nodeIndexList); int userIndex = GetUserIndexFromUserList(tweet.UserName); if (userIndex == -1) { throw new Exception("User Does not exist. It must be there in the list.l\nFunction: AddNodes(CleanTweet)\nLine: 261"); } foreach (NodeInfo node in newNodesList) { // I can remove following operation, because I already have indexes of all newNodeList in nodeIndexList // remove following if performace is reducing nodeKeyIndex = IndexOfNode(_NodeList, node); edgeList = GetEdgeList(nodeKeyIndex); if (edgeList == null) { edgeList = new Hashtable(); _AdjucencyList.Add(nodeKeyIndex, edgeList); } foreach (NodeInfo nodeNameForEdge in newNodesList) { if (!node.IsMatch(nodeNameForEdge)) { int nodeIndexForEdge = IndexOfNode(_NodeList, nodeNameForEdge); if (edgeList.ContainsKey(nodeIndexForEdge)) { EdgeInfo edge = (EdgeInfo)edgeList[nodeIndexForEdge]; edge.TweetWeight += 1; edge.UserWeight += 1; //edge.AddUserInfo(userIndex); // multiply user-tweet ratio with tweet weight to calculate cammulative weight, higher user participation will cause more weight // ratio is highly influencial, find a way to reduce its influence // following weight calculation has many problems, what in case tweet count has not increased in next window but user count has increased // in that case Weight should be meaningful, but I am doing it zero // same is the case what is user count has not increased but tweet count has increased, then weight must not be zero // when user or tweet count remain same in next window, the difference will be zero, which is causing problem here // DISCUS ALL THIS WITH RABEEH SB //if (edge.TweetWeight != 0) // edge.Weight = edge.UserWeight / edge.TweetWeight * edge.TweetWeight; //else // edge.Weight = 0; } else { edgeList.Add(nodeIndexForEdge, new EdgeInfo(userIndex)); } } // end of nodeName != nodeNameForEdge condition } // end of nodeNameForEdge loop } // end of nodeName loop }