org.apache.flink.graph.library.metric.directed.EdgeMetrics.Result Java Examples
The following examples show how to use
org.apache.flink.graph.library.metric.directed.EdgeMetrics.Result.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EdgeMetrics.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getClass() != getClass()) { return false; } Result rhs = (Result) obj; return new EqualsBuilder() .append(triangleTripletCount, rhs.triangleTripletCount) .append(rectangleTripletCount, rhs.rectangleTripletCount) .append(maximumTriangleTriplets, rhs.maximumTriangleTriplets) .append(maximumRectangleTriplets, rhs.maximumRectangleTriplets) .isEquals(); }
Example #2
Source File: EdgeMetrics.java From flink with Apache License 2.0 | 6 votes |
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getClass() != getClass()) { return false; } Result rhs = (Result) obj; return new EqualsBuilder() .append(triangleTripletCount, rhs.triangleTripletCount) .append(rectangleTripletCount, rhs.rectangleTripletCount) .append(maximumTriangleTriplets, rhs.maximumTriangleTriplets) .append(maximumRectangleTriplets, rhs.maximumRectangleTriplets) .isEquals(); }
Example #3
Source File: EdgeMetrics.java From flink with Apache License 2.0 | 6 votes |
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj.getClass() != getClass()) { return false; } Result rhs = (Result) obj; return new EqualsBuilder() .append(triangleTripletCount, rhs.triangleTripletCount) .append(rectangleTripletCount, rhs.rectangleTripletCount) .append(maximumTriangleTriplets, rhs.maximumTriangleTriplets) .append(maximumRectangleTriplets, rhs.maximumRectangleTriplets) .isEquals(); }
Example #4
Source File: EdgeMetrics.java From flink with Apache License 2.0 | 5 votes |
@Override public Result getResult() { long triangleTripletCount = edgeMetricsHelper.getAccumulator(env, TRIANGLE_TRIPLET_COUNT); long rectangleTripletCount = edgeMetricsHelper.getAccumulator(env, RECTANGLE_TRIPLET_COUNT); long maximumTriangleTriplets = edgeMetricsHelper.getAccumulator(env, MAXIMUM_TRIANGLE_TRIPLETS); long maximumRectangleTriplets = edgeMetricsHelper.getAccumulator(env, MAXIMUM_RECTANGLE_TRIPLETS); // each edge is counted twice, once from each vertex, so must be halved return new Result(triangleTripletCount, rectangleTripletCount, maximumTriangleTriplets, maximumRectangleTriplets); }
Example #5
Source File: EdgeMetrics.java From flink with Apache License 2.0 | 5 votes |
@Override public Result getResult() { long triangleTripletCount = edgeMetricsHelper.getAccumulator(env, TRIANGLE_TRIPLET_COUNT); long rectangleTripletCount = edgeMetricsHelper.getAccumulator(env, RECTANGLE_TRIPLET_COUNT); long maximumTriangleTriplets = edgeMetricsHelper.getAccumulator(env, MAXIMUM_TRIANGLE_TRIPLETS); long maximumRectangleTriplets = edgeMetricsHelper.getAccumulator(env, MAXIMUM_RECTANGLE_TRIPLETS); // each edge is counted twice, once from each vertex, so must be halved return new Result(triangleTripletCount, rectangleTripletCount, maximumTriangleTriplets, maximumRectangleTriplets); }
Example #6
Source File: EdgeMetrics.java From flink with Apache License 2.0 | 5 votes |
public Result(long triangleTripletCount, long rectangleTripletCount, long maximumTriangleTriplets, long maximumRectangleTriplets) { this.triangleTripletCount = triangleTripletCount; this.rectangleTripletCount = rectangleTripletCount; this.maximumTriangleTriplets = maximumTriangleTriplets; this.maximumRectangleTriplets = maximumRectangleTriplets; }
Example #7
Source File: EdgeMetricsTest.java From flink with Apache License 2.0 | 5 votes |
/** * Validate a test result. * * @param graph input graph * @param result expected {@link Result} * @param <T> graph ID type * @throws Exception on error */ private static <T extends Comparable<T>> void validate( Graph<T, NullValue, NullValue> graph, Result result) throws Exception { Result edgeMetrics = new EdgeMetrics<T, NullValue, NullValue>() .run(graph) .execute(); assertEquals(result, edgeMetrics); }
Example #8
Source File: EdgeMetricsTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testWithCompleteGraph() throws Exception { long expectedDegree = completeGraphVertexCount - 1; long expectedMaximumTriplets = CombinatoricsUtils.binomialCoefficient((int) expectedDegree, 2); long expectedTriplets = completeGraphVertexCount * expectedMaximumTriplets; Result expectedResult = new Result(expectedTriplets / 3, 2 * expectedTriplets / 3, expectedMaximumTriplets, expectedMaximumTriplets); validate(completeGraph, expectedResult); }
Example #9
Source File: EdgeMetricsTest.java From flink with Apache License 2.0 | 5 votes |
/** * Validate a test result. * * @param graph input graph * @param result expected {@link Result} * @param <T> graph ID type * @throws Exception on error */ private static <T extends Comparable<T>> void validate( Graph<T, NullValue, NullValue> graph, Result result) throws Exception { Result edgeMetrics = new EdgeMetrics<T, NullValue, NullValue>() .run(graph) .execute(); assertEquals(result, edgeMetrics); }
Example #10
Source File: EdgeMetrics.java From flink with Apache License 2.0 | 5 votes |
public Result(long triangleTripletCount, long rectangleTripletCount, long maximumTriangleTriplets, long maximumRectangleTriplets) { this.triangleTripletCount = triangleTripletCount; this.rectangleTripletCount = rectangleTripletCount; this.maximumTriangleTriplets = maximumTriangleTriplets; this.maximumRectangleTriplets = maximumRectangleTriplets; }
Example #11
Source File: EdgeMetricsTest.java From flink with Apache License 2.0 | 5 votes |
@Test public void testWithCompleteGraph() throws Exception { long expectedDegree = completeGraphVertexCount - 1; long expectedMaximumTriplets = CombinatoricsUtils.binomialCoefficient((int) expectedDegree, 2); long expectedTriplets = completeGraphVertexCount * expectedMaximumTriplets; Result expectedResult = new Result(expectedTriplets / 3, 2 * expectedTriplets / 3, expectedMaximumTriplets, expectedMaximumTriplets); validate(completeGraph, expectedResult); }
Example #12
Source File: EdgeMetricsTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Test public void testWithCompleteGraph() throws Exception { long expectedDegree = completeGraphVertexCount - 1; long expectedMaximumTriplets = CombinatoricsUtils.binomialCoefficient((int) expectedDegree, 2); long expectedTriplets = completeGraphVertexCount * expectedMaximumTriplets; Result expectedResult = new Result(expectedTriplets / 3, 2 * expectedTriplets / 3, expectedMaximumTriplets, expectedMaximumTriplets); validate(completeGraph, expectedResult); }
Example #13
Source File: EdgeMetrics.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
@Override public Result getResult() { long triangleTripletCount = edgeMetricsHelper.getAccumulator(env, TRIANGLE_TRIPLET_COUNT); long rectangleTripletCount = edgeMetricsHelper.getAccumulator(env, RECTANGLE_TRIPLET_COUNT); long maximumTriangleTriplets = edgeMetricsHelper.getAccumulator(env, MAXIMUM_TRIANGLE_TRIPLETS); long maximumRectangleTriplets = edgeMetricsHelper.getAccumulator(env, MAXIMUM_RECTANGLE_TRIPLETS); // each edge is counted twice, once from each vertex, so must be halved return new Result(triangleTripletCount, rectangleTripletCount, maximumTriangleTriplets, maximumRectangleTriplets); }
Example #14
Source File: EdgeMetricsTest.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
/** * Validate a test result. * * @param graph input graph * @param result expected {@link Result} * @param <T> graph ID type * @throws Exception on error */ private static <T extends Comparable<T>> void validate( Graph<T, NullValue, NullValue> graph, Result result) throws Exception { Result edgeMetrics = new EdgeMetrics<T, NullValue, NullValue>() .run(graph) .execute(); assertEquals(result, edgeMetrics); }
Example #15
Source File: EdgeMetrics.java From Flink-CEPplus with Apache License 2.0 | 5 votes |
public Result(long triangleTripletCount, long rectangleTripletCount, long maximumTriangleTriplets, long maximumRectangleTriplets) { this.triangleTripletCount = triangleTripletCount; this.rectangleTripletCount = rectangleTripletCount; this.maximumTriangleTriplets = maximumTriangleTriplets; this.maximumRectangleTriplets = maximumRectangleTriplets; }
Example #16
Source File: EdgeMetricsTest.java From flink with Apache License 2.0 | 4 votes |
@Test public void testWithRMatGraph() throws Exception { validate(directedRMatGraph(10, 16), new Result(107817, 315537, 820, 3822)); }
Example #17
Source File: EdgeMetricsTest.java From flink with Apache License 2.0 | 4 votes |
@Test public void testWithEmptyGraphWithVertices() throws Exception { validate(emptyGraphWithVertices, new Result(0, 0, 0, 0)); }
Example #18
Source File: EdgeMetricsTest.java From flink with Apache License 2.0 | 4 votes |
@Test public void testWithSimpleGraph() throws Exception { validate(directedSimpleGraph, new Result(2, 6, 1, 3)); }
Example #19
Source File: EdgeMetricsTest.java From flink with Apache License 2.0 | 4 votes |
@Test public void testWithEmptyGraphWithoutVertices() throws Exception { validate(emptyGraphWithoutVertices, new Result(0, 0, 0, 0)); }
Example #20
Source File: EdgeMetricsTest.java From flink with Apache License 2.0 | 4 votes |
@Test public void testWithRMatGraph() throws Exception { validate(directedRMatGraph(10, 16), new Result(107817, 315537, 820, 3822)); }
Example #21
Source File: EdgeMetricsTest.java From flink with Apache License 2.0 | 4 votes |
@Test public void testWithEmptyGraphWithoutVertices() throws Exception { validate(emptyGraphWithoutVertices, new Result(0, 0, 0, 0)); }
Example #22
Source File: EdgeMetricsTest.java From flink with Apache License 2.0 | 4 votes |
@Test public void testWithEmptyGraphWithVertices() throws Exception { validate(emptyGraphWithVertices, new Result(0, 0, 0, 0)); }
Example #23
Source File: EdgeMetricsTest.java From flink with Apache License 2.0 | 4 votes |
@Test public void testWithSimpleGraph() throws Exception { validate(directedSimpleGraph, new Result(2, 6, 1, 3)); }
Example #24
Source File: EdgeMetricsTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Test public void testWithRMatGraph() throws Exception { validate(directedRMatGraph(10, 16), new Result(107817, 315537, 820, 3822)); }
Example #25
Source File: EdgeMetricsTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Test public void testWithEmptyGraphWithoutVertices() throws Exception { validate(emptyGraphWithoutVertices, new Result(0, 0, 0, 0)); }
Example #26
Source File: EdgeMetricsTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Test public void testWithEmptyGraphWithVertices() throws Exception { validate(emptyGraphWithVertices, new Result(0, 0, 0, 0)); }
Example #27
Source File: EdgeMetricsTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Test public void testWithSimpleGraph() throws Exception { validate(directedSimpleGraph, new Result(2, 6, 1, 3)); }