public static ConnectionGraph CreateUniformConnections(IEnumerable<string> strs, int connectionPerUser) { var s = strs.ToList(); var graph = new ConnectionGraph(); for (int i=0;i<s.Count-1;i++) { for (int j=0;j<connectionPerUser;j++) { var n = Rnd.NextInt(i + 1, s.Count); if (graph.IsConnected(s[i], s[n])) continue; graph.Add(s[i], s[n]); } } return graph; }
public static ConnectionGraph CreateUniformConnections(IEnumerable <string> strs, int connectionPerUser) { var s = strs.ToList(); var graph = new ConnectionGraph(); for (int i = 0; i < s.Count - 1; i++) { for (int j = 0; j < connectionPerUser; j++) { var n = Rnd.NextInt(i + 1, s.Count); if (graph.IsConnected(s[i], s[n])) { continue; } graph.Add(s[i], s[n]); } } return(graph); }
public Blog(ConnectionGraph graph) { this.graph = graph; }