use of org.gradoop.flink.model.impl.operators.sampling.functions.EdgeSourceVertexJoin in project gradoop by dbs-leipzig.
the class RandomWalkSampling method sample.
@Override
protected LogicalGraph sample(LogicalGraph graph) {
LogicalGraph gellyResult = graph.callForGraph(new KRandomJumpGellyVCI<>(numberOfStartVertices, maxIteration, jumpProbability, sampleSize));
DataSet<EPGMVertex> sampledVertices = gellyResult.getVertices().filter(new ByProperty<>(SamplingConstants.PROPERTY_KEY_SAMPLED));
DataSet<EPGMEdge> sampledEdges = graph.getEdges().join(sampledVertices).where(new SourceId<>()).equalTo(new Id<>()).with(new EdgeSourceVertexJoin(SamplingConstants.PROPERTY_KEY_SAMPLED)).join(sampledVertices).where(1).equalTo(new Id<>()).with(new EdgeTargetVertexJoin(SamplingConstants.PROPERTY_KEY_SAMPLED)).filter(new EdgesWithSampledVerticesFilter(Neighborhood.BOTH)).map(new Value0Of3<>());
return graph.getFactory().fromDataSets(sampledVertices, sampledEdges);
}
use of org.gradoop.flink.model.impl.operators.sampling.functions.EdgeSourceVertexJoin in project gradoop by dbs-leipzig.
the class RandomVertexNeighborhoodSampling method sample.
@Override
public LogicalGraph sample(LogicalGraph graph) {
DataSet<EPGMVertex> sampledVertices = graph.getVertices().map(new RandomVertex(sampleSize, randomSeed, SamplingConstants.PROPERTY_KEY_SAMPLED));
DataSet<EPGMEdge> newEdges = graph.getEdges().join(sampledVertices).where(new SourceId<>()).equalTo(new Id<>()).with(new EdgeSourceVertexJoin(SamplingConstants.PROPERTY_KEY_SAMPLED)).join(sampledVertices).where(1).equalTo(new Id<>()).with(new EdgeTargetVertexJoin(SamplingConstants.PROPERTY_KEY_SAMPLED)).filter(new EdgesWithSampledVerticesFilter(neighborType)).map(new Value0Of3<>());
graph = graph.getFactory().fromDataSets(graph.getVertices(), newEdges).callForGraph(new FilterVerticesWithDegreeOtherThanGiven<>(0L));
return graph;
}
Aggregations