private int minVisitIdInSubtree(final OsmNode source, final OsmNode n) {
        if (n.visitID == 1) {
            n.visitID = baseID; // border node
        } else {
            n.visitID = lastVisitID++;
        }
        int minId = n.visitID;
        nodesCreated++;

        OsmLink nextLink = null;
        for (OsmLink l = n.firstlink; l != null; l = nextLink) {
            nextLink = l.getNext(n);

            final OsmNode t = l.getTarget(n);
            if (t == source) {
                continue;
            }
            if (t.isHollow()) {
                continue;
            }

            int minIdSub = t.visitID;
            if (minIdSub == 1) {
                minIdSub = baseID;
            } else if (minIdSub == 0) {
                final int nodesCreatedUntilHere = nodesCreated;
                minIdSub = minVisitIdInSubtree(n, t);
                if (minIdSub > n.visitID) { // peninsula ?
                    nodesCreated = nodesCreatedUntilHere;
                    n.unlinkLink(l);
                    t.unlinkLink(l);
                }
            } else if (minIdSub < baseID) {
                continue;
            } else if (cleanupMode == 2) {
                minIdSub = baseID; // in tree-mode, hitting anything is like a gateway
            }
            if (minIdSub < minId) {
                minId = minIdSub;
            }
        }
        return minId;
    }
Container for link between two Osm nodes

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