public boolean canEscape(final OsmNode n0) {
        boolean sawLowIDs = false;
        lastVisitID++;
        nodes2check.clear();
        nodes2check.add(n0);
        while (!nodes2check.isEmpty()) {
            final OsmNode n = nodes2check.remove(nodes2check.size() - 1);
            if (n.visitID < baseID) {
                n.visitID = lastVisitID;
                nodesCreated++;
                for (OsmLink l = n.firstlink; l != null; l = l.getNext(n)) {
                    final OsmNode t = l.getTarget(n);
                    nodes2check.add(t);
                }
            } else if (n.visitID < lastVisitID) {
                sawLowIDs = true;
            }
        }
        if (sawLowIDs) {
            return true;
        }

        nodes2check.add(n0);
        while (!nodes2check.isEmpty()) {
            final OsmNode n = nodes2check.remove(nodes2check.size() - 1);
            if (n.visitID == lastVisitID) {
                n.visitID = lastVisitID;
                nodesCreated--;
                for (OsmLink l = n.firstlink; l != null; l = l.getNext(n)) {
                    final OsmNode t = l.getTarget(n);
                    nodes2check.add(t);
                }
                n.vanish();
            }
        }

        return false;
    }
Container for link between two Osm nodes

@author ab
main/src/main/java/cgeo/geocaching/brouter/mapaccess/OsmNodesMap.java