org.jgrapht.experimental.isomorphism
Class VertexDegreeEquivalenceComparator<V,E>

java.lang.Object
  extended by org.jgrapht.experimental.isomorphism.VertexDegreeEquivalenceComparator<V,E>
All Implemented Interfaces:
EquivalenceComparator<V,Graph<V,E>>

public class VertexDegreeEquivalenceComparator<V,E>
extends Object
implements EquivalenceComparator<V,Graph<V,E>>

Two vertexes are equivalent under this comparator if and only if:

  1. they have the same IN degree

    AND

  2. they have the same OUT degree

Since:
Jul 21, 2005
Author:
Assaf

Nested Class Summary
protected  class VertexDegreeEquivalenceComparator.InOutDegrees
          Simple structure used to hold the two ints: vertex in degree and vertex out degree.
 
Constructor Summary
VertexDegreeEquivalenceComparator()
           
 
Method Summary
 boolean equivalenceCompare(V vertex1, V vertex2, Graph<V,E> context1, Graph<V,E> context2)
          Compares the in degrees and the out degrees of the two vertexes.
 int equivalenceHashcode(V vertex, Graph<V,E> context)
          Hashes using the in & out degree of a vertex
protected  VertexDegreeEquivalenceComparator.InOutDegrees getInOutDegrees(Graph<V,E> aContextGraph, V vertex)
          Calculates the In and Out degrees of vertexes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VertexDegreeEquivalenceComparator

public VertexDegreeEquivalenceComparator()
Method Detail

equivalenceCompare

public boolean equivalenceCompare(V vertex1,
                                  V vertex2,
                                  Graph<V,E> context1,
                                  Graph<V,E> context2)
Compares the in degrees and the out degrees of the two vertexes.

One may reside in an Undirected Graph and the other in a Directed graph, or both on the same graph type.

Specified by:
equivalenceCompare in interface EquivalenceComparator<V,Graph<V,E>>
See Also:
EquivalenceComparator.equivalenceCompare(Object, Object, Object, Object)

equivalenceHashcode

public int equivalenceHashcode(V vertex,
                               Graph<V,E> context)
Hashes using the in & out degree of a vertex

Specified by:
equivalenceHashcode in interface EquivalenceComparator<V,Graph<V,E>>
See Also:
EquivalenceComparator.equivalenceHashcode(Object, Object)

getInOutDegrees

protected VertexDegreeEquivalenceComparator.InOutDegrees getInOutDegrees(Graph<V,E> aContextGraph,
                                                                         V vertex)
Calculates the In and Out degrees of vertexes. Supported graph types: UnDirectedGraph, DirectedGraph. In UnDirected graph, the in = out (as if it was undirected and every edge is both an in and out edge)

Parameters:
aContextGraph -
vertex -


Copyright © 2013. All rights reserved.