public class StructurallyEquivalent<V,E> extends Object implements com.google.common.base.Function<Graph<V,E>,VertexPartition<V,E>>
You can extend this class to have a different definition of equivalence (by
overriding isStructurallyEquivalent
), and may give it hints for
accelerating the process by overriding canPossiblyCompare
.
(For example, in a bipartite graph, canPossiblyCompare
may
return false
for vertices in
different partitions. This function should be fast.)
Constructor and Description |
---|
StructurallyEquivalent() |
Modifier and Type | Method and Description |
---|---|
VertexPartition<V,E> |
apply(Graph<V,E> g) |
protected boolean |
canBeEquivalent(V v1,
V v2)
This is a space for optimizations.
|
protected Set<Pair<V>> |
getEquivalentPairs(Graph<V,?> g)
For each vertex pair v, v1 in G, checks whether v and v1 are fully
equivalent: meaning that they connect to the exact same vertices.
|
protected boolean |
isStructurallyEquivalent(Graph<V,?> g,
V v1,
V v2) |
protected Set<Pair<V>> getEquivalentPairs(Graph<V,?> g)
g
- the graph whose equivalent pairs are to be generatedprotected boolean isStructurallyEquivalent(Graph<V,?> g, V v1, V v2)
g
- the graph in which the structural equivalence comparison is to take placev1
- the vertex to check for structural equivalence to v2v2
- the vertex to check for structural equivalence to v1true
if v1
's predecessors/successors are equal to
v2
's predecessors/successorsprotected boolean canBeEquivalent(V v1, V v2)
v1
- the first vertex to comparev2
- the second vertex to comparetrue
if the vertices can be equivalentCopyright © 2015. All rights reserved.