Graph provides the ability to test routing algorithms for ring-based structured p2p networks
Key features provided by Graph include support for Tunnels, latency, hop count, user specified latency, tweaking of network size, near neighbor count, shortcut count.
Beispiel #1
0
    public static void Main(string[] args)
    {
      Parameters p = new Parameters("Graph", "Graph - Brunet Network Modeler.");
      p.Parse(args);
      if(p.Help) {
        p.ShowHelp();
        return;
      }
      if(p.ErrorMessage != string.Empty) {
        Console.WriteLine(p.ErrorMessage);
        p.ShowHelp();
        return;
      }

      Console.WriteLine("Creating a graph with base size: {0}, near connections: {1}, shortcuts {2}",
          p.Size, p.Near, p.Shortcuts);
      Graph graph = new Graph(p.Size, p.Near, p.Shortcuts, p.Seed, p.LatencyMap);
      Console.WriteLine("Done populating graph...");
      graph.Crawl();
      graph.AllToAll();
      graph.BroadcastAverage();
      if(p.Outfile != string.Empty) {
        Console.WriteLine("Saving dot file to: " + p.Outfile);
        graph.WriteGraphFile(p.Outfile);
      }
    }
Beispiel #2
0
    public static void Main(string[] args)
    {
      int size = 100;
      int shortcuts = 1;
      int near = 3;
      int seed = (new Random()).Next();
      string outfile = string.Empty;
      string dataset = string.Empty;

      int carg = 0;
      while(carg < args.Length) {
        string[] parts = args[carg++].Split('=');
        try {
          switch(parts[0]) {
            case "--size":
              size = Int32.Parse(parts[1]);
              break;
            case "--shortcuts":
              shortcuts = Int32.Parse(parts[1]);
              break;
            case "--near":
              near = Int32.Parse(parts[1]);
              break;
            case "--seed":
              seed = Int32.Parse(parts[1]);
              break;
            case "--outfile":
              outfile = parts[1];
              break;
            case "--dataset":
              dataset = parts[1];
              break;
            default:
              throw new Exception("Invalid parameter");
          }
        } catch {
          Console.WriteLine("oops...");
        }
      }

      Console.WriteLine("Creating a graph with base size: {0}, near connections: {1}, shortcuts {2}",
          size, near, shortcuts);

      List<List<int>> latency_map = null;
      if(dataset != string.Empty) {
        latency_map = Graph.ReadLatencyDataSet(dataset);
      }

      Graph graph = new Graph(size, near, shortcuts, seed, latency_map);
      Console.WriteLine("Done populating graph...");
      graph.Crawl();
      graph.AllToAll();
      if(outfile != string.Empty) {
        Console.WriteLine("Saving dot file to: " + outfile);
        graph.WriteGraphFile(outfile);
      }
    }