throw new NullPointerException();
if (!(graph instanceof KmerSearchableGraph))
throw new IllegalArgumentException("the input graph must implement " + KmerSearchableGraph.class.getName());
final int kmerSize = graph.getKmerSize();
final KmerSequence haplotypeKmers = new KmerSequence(sequence,kmerSize);
if (haplotypeKmers.kmerSize() != graph.getKmerSize())
throw new IllegalArgumentException("incompatible kmer sizes " + graph.getKmerSize() + " != " + haplotypeKmers.kmerSize());
V vertex = null;
int i;
for (i = 0; i < haplotypeKmers.size(); i++)
if ((vertex = ((KmerSearchableGraph<V,E>)graph).findKmer(haplotypeKmers.get(i))) != null)
break;
if (vertex == null)
return null;
if (!graph.containsVertex(vertex))
throw new IllegalStateException("vertex does not belong to graph.");