KT
 the key type of top verticesKB
 the key type of bottom verticesVVT
 the vertex value type of top verticesVVB
 the vertex value type of bottom verticesEV
 the edge value typepublic class BipartiteGraph<KT,KB,VVT,VVB,EV> extends Object
Graph
. Edges can only exist
between a pair of vertices from different vertices sets. E.g. there can be no vertices between a
pair of top vertices.
Bipartite graphs are useful to represent graphs with two sets of objects, like researchers and their publications, where an edge represents that a particular publication was authored by a particular author.
Bipartite interface is different from Graph
interface, so to apply algorithms that
work on a regular graph a bipartite graph should be first converted into a Graph
instance. This can be achieved by using the projection methods.
Modifier and Type  Method and Description 

static <KT,KB,VVT,VVB,EV> 
fromDataSet(DataSet<Vertex<KT,VVT>> topVertices,
DataSet<Vertex<KB,VVB>> bottomVertices,
DataSet<BipartiteEdge<KT,KB,EV>> edges,
ExecutionEnvironment context)
Create bipartite graph from datasets.

DataSet<Vertex<KB,VVB>> 
getBottomVertices()
Get dataset with bottom vertices.

DataSet<BipartiteEdge<KT,KB,EV>> 
getEdges()
Get dataset with graph edges.

DataSet<Vertex<KT,VVT>> 
getTopVertices()
Get dataset with top vertices.

Graph<KB,VVB,Projection<KT,VVT,VVB,EV>> 
projectionBottomFull()
Convert a bipartite graph into a graph that contains only bottom vertices.

Graph<KB,VVB,Tuple2<EV,EV>> 
projectionBottomSimple()
Convert a bipartite graph into an undirected graph that contains only bottom vertices.

Graph<KT,VVT,Projection<KB,VVB,VVT,EV>> 
projectionTopFull()
Convert a bipartite graph into a graph that contains only top vertices.

Graph<KT,VVT,Tuple2<EV,EV>> 
projectionTopSimple()
Convert a bipartite graph into an undirected graph that contains only top vertices.

public static <KT,KB,VVT,VVB,EV> BipartiteGraph<KT,KB,VVT,VVB,EV> fromDataSet(DataSet<Vertex<KT,VVT>> topVertices, DataSet<Vertex<KB,VVB>> bottomVertices, DataSet<BipartiteEdge<KT,KB,EV>> edges, ExecutionEnvironment context)
topVertices
 dataset of top vertices in the graphbottomVertices
 dataset of bottom vertices in the graphedges
 dataset of edges between verticescontext
 Flink execution contextpublic DataSet<Vertex<KT,VVT>> getTopVertices()
public DataSet<Vertex<KB,VVB>> getBottomVertices()
public DataSet<BipartiteEdge<KT,KB,EV>> getEdges()
public Graph<KT,VVT,Tuple2<EV,EV>> projectionTopSimple()
The simple projection performs a single join and returns edges containing the bipartite edge values.
Note: KT must override .equals(). This requirement may be removed in a future release.
public Graph<KB,VVB,Tuple2<EV,EV>> projectionBottomSimple()
The simple projection performs a single join and returns edges containing the bipartite edge values.
Note: KB must override .equals(). This requirement may be removed in a future release.
public Graph<KT,VVT,Projection<KB,VVB,VVT,EV>> projectionTopFull()
The full projection performs three joins and returns edges containing the connecting vertex ID and value, both top vertex values, and both bipartite edge values.
Note: KT must override .equals(). This requirement may be removed in a future release.
public Graph<KB,VVB,Projection<KT,VVT,VVB,EV>> projectionBottomFull()
The full projection performs three joins and returns edges containing the connecting vertex ID and value, both bottom vertex values, and both bipartite edge values.
Note: KB must override .equals(). This requirement may be removed in a future release.
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.