Package gnu.trove.list.array

Examples of gnu.trove.list.array.TIntArrayList.toArray()


    MaximalWeightedClique maximalWeightedClique = new MaximalWeightedClique();
    maximalWeightedClique.setGraph(graph);
    TIntArrayList ans = maximalWeightedClique
        .findMaximumWeightedClique(new double[] { 1, 1, 1, 1, 1, 1, 1 });
    ans.sort();
    int[] arr = ans.toArray();
    Assert.assertArrayEquals("Found the wrong clique",
        new int[] { 0, 3, 4 }, arr);
  }
 
  @Test
View Full Code Here


    MaximalWeightedClique maximalWeightedClique = new MaximalWeightedClique();
    maximalWeightedClique.setGraph(graph);
    TIntArrayList ans = maximalWeightedClique
        .findMaximumWeightedClique(new double[] { 1, 1, 5, 1, 1, 1, 1 });
    ans.sort();
    int[] arr = ans.toArray();
    Assert.assertArrayEquals("Found the wrong clique",
        new int[] { 2 }, arr);
  }

  @Test
View Full Code Here

    MaximalWeightedClique maximalWeightedClique = new MaximalWeightedClique();
    maximalWeightedClique.setGraph(graph);
    TIntArrayList ans = maximalWeightedClique
        .findMaximumWeightedClique(weights);
    ans.sort();
    int[] arr = ans.toArray();
    int[] expected = new int[nodes];
    for (int i = 0; i < expected.length; i++) {
      expected[i] = i;
    }
    Assert.assertArrayEquals("Found the wrong clique", expected, arr);
View Full Code Here

    MaximalWeightedClique maximalWeightedClique = new MaximalWeightedClique();
    maximalWeightedClique.setGraph(graph);
    TIntArrayList ans = maximalWeightedClique
        .findMaximumWeightedClique(weights);
    ans.sort();
    int[] arr = ans.toArray();
    int[] expected = new int[] { 0, 5 };
    Assert.assertArrayEquals("Found the wrong clique", expected, arr);
  }

  @Test
View Full Code Here

    maximalWeightedClique.setGraph(graph);

    TIntArrayList ans = maximalWeightedClique
        .findMaximumWeightedClique(weights);
    ans.sort();
    int[] arr = ans.toArray();
    int[] expected = new int[] { 1, 2, 3 };
    Assert.assertArrayEquals("Found the wrong clique", expected, arr);

    TIntArrayList ans2 = maximalWeightedClique.findMaximumWeightedClique(
        weights, new TIntArrayList(new int[] { 6 }));
View Full Code Here

    Assert.assertArrayEquals("Found the wrong clique", expected, arr);

    TIntArrayList ans2 = maximalWeightedClique.findMaximumWeightedClique(
        weights, new TIntArrayList(new int[] { 6 }));
    ans2.sort();
    int[] arr2 = ans2.toArray();
    int[] expected2 = new int[] { 3, 4, 5, 6 };
    Assert.assertArrayEquals("Found the wrong clique", expected2, arr2);

    TIntArrayList ans3 = maximalWeightedClique.findMaximumWeightedClique(
        weights, new TIntArrayList(new int[] { 6, 3 }));
View Full Code Here

    Assert.assertArrayEquals("Found the wrong clique", expected2, arr2);

    TIntArrayList ans3 = maximalWeightedClique.findMaximumWeightedClique(
        weights, new TIntArrayList(new int[] { 6, 3 }));
    ans3.sort();
    int[] arr3 = ans3.toArray();
    int[] expected3 = new int[] { 1, 2, 3 };
    Assert.assertArrayEquals(
        "Found the wrong clique " + Arrays.toString(arr3), expected3,
        arr3);
View Full Code Here

        arr3);

    TIntArrayList ans4 = maximalWeightedClique.findMaximumWeightedClique(
        weights, new TIntArrayList(new int[] { 7 }));
    ans4.sort();
    int[] arr4 = ans4.toArray();
    int[] expected4 = new int[] { 7 };
    Assert.assertArrayEquals("Found the wrong clique", expected4, arr4);
  }

  @Test
View Full Code Here

        maximalWeightedClique.setClassesComparator(comparator);
        TIntArrayList ansTemp = maximalWeightedClique
            .findMaximumWeightedClique(weightsArr, mandatoryList);
       
        ansTemp.sort();
        final int[] ansArray = ansTemp.toArray();
        double curWeight = evaluate(ansArray, weightsArr);
        if (curWeight > ansWeight) {
          ansWeight = curWeight;
          ans = ansTemp;
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.