results.add(new GraphCommunity((Integer)value.get("hierLevel"), (Long)value.get("id"), new Pair<Double, Double>((Double)value.get("x"), (Double)value.get("y")),
@Test public void testRecordAggregation () { GraphAnalyticsRecord a = new GraphAnalyticsRecord(1, Arrays.asList(_sampleCommunity)); GraphCommunity community_b = new GraphCommunity(_hierLevel, 456L, new Pair<Double, Double>(3.3, 4.4), 3.4, 4, 54, "blah4\tblah5", true, _parentID, _parentCoords, _parentRadius, _statsList, _interEdges, _intraEdges); GraphAnalyticsRecord b = new GraphAnalyticsRecord(1, Arrays.asList(community_b)); GraphAnalyticsRecord c = new GraphAnalyticsRecord(2, Arrays.asList(community_b, _sampleCommunity)); Assert.assertEquals(c, GraphAnalyticsRecord.addRecords(a, b)); }
@Test public void testCommunityToRecord () { GraphAnalyticsRecord a = new GraphAnalyticsRecord(1, Arrays.asList(_sampleCommunity)); GraphCommunity community_b = new GraphCommunity(_hierLevel, 456L, new Pair<Double, Double>(3.3, 4.4), 3.4, 4, 54, "blah4\tblah5", true, _parentID, _parentCoords, _parentRadius, _statsList, _interEdges, _intraEdges); GraphAnalyticsRecord c = new GraphAnalyticsRecord(2, Arrays.asList(community_b, _sampleCommunity)); Assert.assertEquals(c, GraphAnalyticsRecord.addCommunityToRecord(a, community_b)); }
@Test public void testInterEdgeToCommunity () { GraphCommunity a = _sampleCommunity; GraphEdge e1 = new GraphEdge(987L, 0.1, 0.2, 999L); GraphCommunity b = a; b.addInterEdgeToCommunity(e1); List<GraphEdge> edges = Arrays.asList(e1, new GraphEdge(0L, 4.3, 2.1, 5L), new GraphEdge(43L, 5.6, 7.8, 3L)); GraphCommunity c = new GraphCommunity(_hierLevel, _id, _coords, _radius, _degree, _numNodes, _metadata, _bIsPrimaryNode, _parentID, _parentCoords, _parentRadius, _statsList, edges, _intraEdges); Assert.assertEquals(c, b); }
@Test public void testIntraEdgeToCommunity () { GraphCommunity a = _sampleCommunity; GraphEdge e2 = new GraphEdge(988L, 0.11, 0.22, 1L); GraphCommunity b = a; b.addIntraEdgeToCommunity(e2); List<GraphEdge> edges = Arrays.asList(new GraphEdge(2L, 4.2, 2.0, 6L), new GraphEdge(44L, 5.5, 7.7, 4L), e2); GraphCommunity c = new GraphCommunity(_hierLevel, _id, _coords, _radius, _degree, _numNodes, _metadata, _bIsPrimaryNode, _parentID, _parentCoords, _parentRadius, _statsList, _interEdges, edges); Assert.assertEquals(c, b); }
@Test public void testEmptyRecordAggregation () { GraphAnalyticsRecord a = new GraphAnalyticsRecord(0, null); GraphCommunity community_b = new GraphCommunity(_hierLevel, 456L, new Pair<Double, Double>(3.3, 4.4), 3.4, 4, 54, "blah4\tblah5", true, _parentID, _parentCoords, _parentRadius, _statsList, _interEdges, _intraEdges); GraphAnalyticsRecord b = new GraphAnalyticsRecord(1, Arrays.asList(community_b)); Assert.assertEquals(b, GraphAnalyticsRecord.addRecords(a, b)); }
GraphAnalyticsRecord b = new GraphAnalyticsRecord(1, Arrays.asList(community_b)); GraphCommunity community_c = new GraphCommunity(1, 567L, new Pair<Double, Double>(3.3, 4.4),
GraphAnalyticsRecord b = new GraphAnalyticsRecord(1, Arrays.asList(community_b)); GraphCommunity community_c = new GraphCommunity(1, 123L, new Pair<Double, Double>(1.2, 3.4),