Exemplo n.º 1
0
 public static Graph GenerateErdosRenyi(int n, int m)
 {
     Random r = new Random();
     Graph g = new Graph();
     for (int i = 0; i < m; ++i)
     {
         g.AddEdge(r.Next(n), r.Next(n));
     }
     return g;
 }
Exemplo n.º 2
0
 //==========================================================================================================
 public Graph GenerateAccessabilityGraph()
 {
     var G = new Graph();
     foreach (var kvp in LeafMapper)
     {
         var leaf = kvp.Value;
         var list = leaf.GetAccessableLeaves();
         foreach (var l in list)
         {
             G.AddEdge(leaf.id, l.id);
         }
     }
     return G;
 }