E
- the type of the elements in the setC
- the type of the context the element is compared against, e.g. a
Graphpublic interface EquivalenceComparator<E,C>
It is similar, in concept, to the Object.hashcode() and Object.equals() methods, but instead of checking whether two objects are equal, it is used to check whether they are part of the same Equivalence group, where the definition of an "equivalence" is defined by the implementation of this interface.
A specific usage of it is shown below, but it may be used outside of the graph-theory class library.
In Isomorphism, edges/vertexes matching may relay on none/some/all of the vertex/edge properties. For example, if a vertex representing a person contains two properties: gender(male/female) and person name(string), we can decide that to check isomorphism in vertex groups of gender only. Meaning if this is the graph:
(male,"Don")---->(female,"Dana")--->(male,"John")
if there is no equivalence set at all , this graph can be described as: (1)---->(2)---->(3)
if the equivalence set is determined only by the gender property : (male)---->(female)---->(male)
and if it is determined by both properties: (the original figure) The isomorphism inspection may return different result according to this choice. If the other graph is: (male,"Don")--->(male,"Sunny")---->(male,"Jo") In no eq.set they are Isomorphic, but for the two other cases they are not. Other examples: Nodes with the same degree, Edges with the same weight, Graphs with the same number of nodes and edges.
Modifier and Type | Method and Description |
---|---|
boolean |
equivalenceCompare(E arg1,
E arg2,
C context1,
C context2) |
int |
equivalenceHashcode(E arg1,
C context) |