Search in sources :

Example 1 with EdgeSourceVertexJoin

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);
}
Also used : EPGMEdge(org.gradoop.common.model.impl.pojo.EPGMEdge) EdgeTargetVertexJoin(org.gradoop.flink.model.impl.operators.sampling.functions.EdgeTargetVertexJoin) EPGMVertex(org.gradoop.common.model.impl.pojo.EPGMVertex) EdgesWithSampledVerticesFilter(org.gradoop.flink.model.impl.operators.sampling.functions.EdgesWithSampledVerticesFilter) EdgeSourceVertexJoin(org.gradoop.flink.model.impl.operators.sampling.functions.EdgeSourceVertexJoin) LogicalGraph(org.gradoop.flink.model.impl.epgm.LogicalGraph) SourceId(org.gradoop.flink.model.impl.functions.epgm.SourceId) Id(org.gradoop.flink.model.impl.functions.epgm.Id)

Example 2 with EdgeSourceVertexJoin

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;
}
Also used : RandomVertex(org.gradoop.flink.model.impl.operators.sampling.functions.RandomVertex) EPGMVertex(org.gradoop.common.model.impl.pojo.EPGMVertex) FilterVerticesWithDegreeOtherThanGiven(org.gradoop.flink.model.impl.operators.sampling.functions.FilterVerticesWithDegreeOtherThanGiven) EdgesWithSampledVerticesFilter(org.gradoop.flink.model.impl.operators.sampling.functions.EdgesWithSampledVerticesFilter) EPGMEdge(org.gradoop.common.model.impl.pojo.EPGMEdge) EdgeSourceVertexJoin(org.gradoop.flink.model.impl.operators.sampling.functions.EdgeSourceVertexJoin) SourceId(org.gradoop.flink.model.impl.functions.epgm.SourceId) Id(org.gradoop.flink.model.impl.functions.epgm.Id) EdgeTargetVertexJoin(org.gradoop.flink.model.impl.operators.sampling.functions.EdgeTargetVertexJoin)

Aggregations

EPGMEdge (org.gradoop.common.model.impl.pojo.EPGMEdge)2 EPGMVertex (org.gradoop.common.model.impl.pojo.EPGMVertex)2 Id (org.gradoop.flink.model.impl.functions.epgm.Id)2 SourceId (org.gradoop.flink.model.impl.functions.epgm.SourceId)2 EdgeSourceVertexJoin (org.gradoop.flink.model.impl.operators.sampling.functions.EdgeSourceVertexJoin)2 EdgeTargetVertexJoin (org.gradoop.flink.model.impl.operators.sampling.functions.EdgeTargetVertexJoin)2 EdgesWithSampledVerticesFilter (org.gradoop.flink.model.impl.operators.sampling.functions.EdgesWithSampledVerticesFilter)2 LogicalGraph (org.gradoop.flink.model.impl.epgm.LogicalGraph)1 FilterVerticesWithDegreeOtherThanGiven (org.gradoop.flink.model.impl.operators.sampling.functions.FilterVerticesWithDegreeOtherThanGiven)1 RandomVertex (org.gradoop.flink.model.impl.operators.sampling.functions.RandomVertex)1