Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jgrapht.graph
Class DefaultGraphMapping<V,E>

    java.lang.Object
      org.jgrapht.graph.DefaultGraphMapping<V,E>

All Implemented Interfaces:
  GraphMapping<V,E>

    public class DefaultGraphMapping<V,E>

extends java.lang.Object
implements GraphMapping<V,E>

Implementation of the GraphMapping interface. The performance of `getVertex/EdgeCorrespondence` is based on the performance of the concrete Map class which is passed in the constructor. For example, using hashmaps will provide O(1) performence.

Since:
  Jul 30, 2005
Author:
  Assaf

Constructor Summary
`DefaultGraphMapping(java.util.Map<V,V> g1ToG2, java.util.Map<V,V> g2ToG1, Graph<V,E> g1, Graph<V,E> g2)` The maps themselves are used.

Method Summary
`E` | `getEdgeCorrespondence(E currEdge, boolean forward)` Gets the mapped value where the key is `edge`
`V` | `getVertexCorrespondence(V keyVertex, boolean forward)` Gets the mapped value where the key is `vertex`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultGraphMapping

    public DefaultGraphMapping(java.util.Map<V,V> g1ToG2,
                               java.util.Map<V,V> g2ToG1,
                               Graph<V,E> g1,
                               Graph<V,E> g2)

  The maps themselves are used. There is no defensive-copy. Assumption: The key and value in the mappings are of valid graph objects. It is not checked.

  Parameters:
    `g1ToG2` -
    `g2ToG1` -
    `g1` -
    `g2` -

Method Detail

### getEdgeCorrespondence

    public E getEdgeCorrespondence(E currEdge,
                                   boolean forward)

  Description copied from interface: `GraphMapping`
  Gets the mapped value where the key is `edge`

  Specified by:
    `getEdgeCorrespondence` in interface `GraphMapping<V,E>`
  Parameters:
    `currEdge` - edge in one of the graphs
    `forward` - if true, uses mapping from graph1 to graph2; if false, use mapping from graph2 to graph1
  Returns:
    corresponding edge in other graph, or null if none

### getVertexCorrespondence

    public V getVertexCorrespondence(V keyVertex,
                                     boolean forward)

  Description copied from interface: `GraphMapping`
  Gets the mapped value where the key is `vertex`

  Specified by:
    `getVertexCorrespondence` in interface `GraphMapping<V,E>`
  Parameters:
    `keyVertex` - vertex in one of the graphs
    `forward` - if true, uses mapping from graph1 to graph2; if false, use mapping from graph2 to graph1
  Returns:
    corresponding vertex in other graph, or null if none

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD