Skip to content

Commit

Permalink
[FLINK-4646] [gelly] Add BipartiateGraph
Browse files Browse the repository at this point in the history
This closes apache#2564
  • Loading branch information
mushketyk authored and greghogan committed Dec 9, 2016
1 parent 9ab494a commit 365cd98
Show file tree
Hide file tree
Showing 9 changed files with 807 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ public class Edge<K, V> extends Tuple3<K, K, V>{

public Edge(){}

public Edge(K src, K trg, V val) {
this.f0 = src;
this.f1 = trg;
this.f2 = val;
public Edge(K source, K target, V value) {
this.f0 = source;
this.f1 = target;
this.f2 = value;
}

/**
Expand All @@ -49,8 +49,8 @@ public Edge<K, V> reverse() {
return new Edge<>(this.f1, this.f0, this.f2);
}

public void setSource(K src) {
this.f0 = src;
public void setSource(K source) {
this.f0 = source;
}

public K getSource() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http:https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.flink.graph.bipartite;

import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.graph.Edge;

/**
* A BipartiteEdge represents a link between top and bottom vertices
* in a {@link BipartiteGraph}. It is generalized form of {@link Edge}
* where the source and target vertex IDs can be of different types.
*
* @param <KT> the key type of the top vertices
* @param <KB> the key type of the bottom vertices
* @param <EV> the edge value type
*/
public class BipartiteEdge<KT, KB, EV> extends Tuple3<KT, KB, EV> {

private static final long serialVersionUID = 1L;

public BipartiteEdge() {}

public BipartiteEdge(KT topId, KB bottomId, EV value) {
this.f0 = topId;
this.f1 = bottomId;
this.f2 = value;
}

public KT getTopId() {
return this.f0;
}

public void setTopId(KT topId) {
this.f0 = topId;
}

public KB getBottomId() {
return this.f1;
}

public void setBottomId(KB bottomId) {
this.f1 = bottomId;
}

public EV getValue() {
return this.f2;
}

public void setValue(EV value) {
this.f2 = value;
}
}
Loading

0 comments on commit 365cd98

Please sign in to comment.