Interface MatrixElementOperations<E>
-
- All Known Implementing Classes:
RealMatrixElementOperations
public interface MatrixElementOperations<E>
An interface for specifying the behavior of graph/matrix operations for a particular element type.Graph/matrix multiplication requires the definition of two operations:
- Calculating an aggregate property of paths of length 2 between two vertices v1 and v2 (analogous to element multiplication in matrix arithmetic); this is handled by computePathData().
- Aggregating the properties of all such paths, and assigning the result to a new edge in the output graph (analogous to element addition in matrix arithmetic); this is handled by mergePaths().
Together, computePathData() and mergePaths() specify how the equivalent of the vector inner (dot) product is to function.
For instance, to implement the equivalent of standard matrix multiplication on two graphs, computePathData() should return the products of the weights of a two-edge path, and mergePaths() should add the output of computePathData() to an existing edge (or possibly create such an edge if none exists).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.Number
computePathData(E e1, E e2)
If either e1 or e2 is null, the Object reference returned should be null.java.util.Map<E,java.lang.Number>
getEdgeData()
Returns a map from edges to values.void
mergePaths(E e, java.lang.Object pathData)
If either e or pathData is null, the effect of mergePaths() is implementation-dependent.
-
-
-
Method Detail
-
mergePaths
void mergePaths(E e, java.lang.Object pathData)
If either e or pathData is null, the effect of mergePaths() is implementation-dependent.- Parameters:
e
- (possibly) existing edge in the output graph which represents a path in the input graph(s)pathData
- data (which represents another path with the same source and destination as e in the input graphs) which is to be merged into e
-
computePathData
java.lang.Number computePathData(E e1, E e2)
If either e1 or e2 is null, the Object reference returned should be null.- Parameters:
e1
- first edge from 2-edge path in input graph(s)e2
- second edge from 2-edge path in input graph(s)- Returns:
- aggregation of data from the edges of the 2-edge path (from source of e1 to destination of e2) comprised of (e1, e2)
-
getEdgeData
java.util.Map<E,java.lang.Number> getEdgeData()
Returns a map from edges to values.
-
-