Exemplo n.º 1
0
  public static GraphNode[] buildComplete(GraphModel graph, int degree, Relation relation) {
    GraphNode nodes[] = new GraphNode[degree];
    GraphBuilder builder = graph.getBuilder();
    for (int nodeCnt = 0; nodeCnt < degree; nodeCnt++) {
      GraphNode node = new MethodElement("FakeSig", nameGen("complete", nodeCnt), "boolean");
      nodes[nodeCnt] = builder.newNode(node);
    }

    for (int head = 0; head < (degree - 1); head++) {
      for (int tail = head + 1; tail < degree; tail++) {
        graph.addEdge(relation, nodes[head], nodes[tail]);
      }
    }

    return nodes;
  }