V
- the type of the verticesE
- the type of the edgespublic class AHUUnrootedTreeIsomorphismInspector<V,E> extends Object implements IsomorphismInspector<V,E>
The original algorithm was first presented in "Alfred V. Aho and John E. Hopcroft. 1974. The Design and Analysis of Computer Algorithms (1st ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA."
This implementation runs in linear time (in the number of vertices of the input trees) while using a linear amount of memory.
For an implementation that supports rooted trees see AHURootedTreeIsomorphismInspector
.
For an implementation that supports rooted forests see AHUForestIsomorphismInspector
.
Note: This inspector only returns a single mapping (chosen arbitrarily) rather than all possible mappings.
Constructor and Description |
---|
AHUUnrootedTreeIsomorphismInspector(Graph<V,E> tree1,
Graph<V,E> tree2)
Construct a new AHU unrooted tree isomorphism inspector.
|
Modifier and Type | Method and Description |
---|---|
IsomorphicGraphMapping<V,E> |
getMapping()
Get an isomorphism between the input trees or
null if none exists. |
Iterator<GraphMapping<V,E>> |
getMappings()
Get an iterator over all calculated (isomorphic) mappings between two graphs.
|
boolean |
isomorphismExists()
Check if an isomorphism exists.
|
public AHUUnrootedTreeIsomorphismInspector(Graph<V,E> tree1, Graph<V,E> tree2)
tree1
- the first treetree2
- the second treeNullPointerException
- if tree1
or tree2
is null
IllegalArgumentException
- if tree1
or tree2
is not undirectedIllegalArgumentException
- if tree1
or tree2
is emptypublic Iterator<GraphMapping<V,E>> getMappings()
getMappings
in interface IsomorphismInspector<V,E>
public boolean isomorphismExists()
isomorphismExists
in interface IsomorphismInspector<V,E>
public IsomorphicGraphMapping<V,E> getMapping()
null
if none exists.null
is none existsCopyright © 2018. All rights reserved.