Created
July 1, 2016 17:13
-
-
Save richwhitjr/ec27b4ee0405a48a5276016622371ce1 to your computer and use it in GitHub Desktop.
Example Graph API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| case class Edge[T, S](source: T, dest: T, attr: S) | |
| case class Vertex[T, S](id: T, attr: S) | |
| case class EdgeTriplet[T, S, Q](source: Vertex[T, Q], dest: Vertex[T, Q], edge: Edge[T, S]) | |
| abstract class Graph[T: Ordering : ClassTag, S: ClassTag, Q: ClassTag, M[_], X[_, _, _] <: Graph[_, _, _, M, X]](val edges: M[Edge[T, S]], val vertices: M[Vertex[T, Q]]) { | |
| def triplets: M[EdgeTriplet[T, S, Q]] | |
| def outerJoinVertices[U: ClassTag, VD2: ClassTag](other: M[(T, U)])(mapFunc: (T, Q, Option[U]) => VD2): Graph[T, S, VD2, M, X] | |
| def joinVertices[U: ClassTag, VD2: ClassTag](other: M[(T, U)])(mapFunc: (T, Q, U) => VD2): Graph[T, S, VD2, M, X] | |
| def persist(storageLevel: StorageLevel): Graph[T, S, Q, M, X] | |
| def cache(): Graph[T, S, Q, M, X] | |
| def checkpoint(): Unit | |
| def mapVertices[A: ClassTag](map: Vertex[T, Q] => A): Graph[T, S, A, M, X] | |
| def mapEdges[A: ClassTag](map: Edge[T, S] => A): Graph[T, A, Q, M, X] | |
| def mapTriplets[A: ClassTag, B: ClassTag](map: EdgeTriplet[T, S, Q] => EdgeTriplet[T, A, B]): Graph[T, A, B, M, X] | |
| def collectNeighborIds: M[Vertex[T, Array[T]]] | |
| def collectNeighbors: M[Vertex[T, Array[Vertex[T, Q]]]] | |
| def collectEdges: M[Vertex[T, Array[Edge[T, S]]]] | |
| def subgraph(epred: EdgeTriplet[T, S, Q] => Boolean = _ => true, vpred: Vertex[T, Q] => Boolean = _ => true): Graph[T, S, Q, M, X] | |
| def mask[A: ClassTag, B: ClassTag](other: X[T, A, B]): Graph[T, S, Q, M, X] | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment