src/gedlib/equaliso.c
/*=======================================================
 * iso_nodes -- See if two node structures are isomorphic
 *=====================================================*/
- See if two node structures are isomorphic
- See if two node structures are isomorphic
BOOLEAN
iso_nodes (NODE root1,
           NODE root2,
           BOOLEAN kids,
           BOOLEAN sibs)
{
	INT len1, len2;
	NODE node1, node2;
	if (!root1 && !root2) return TRUE;
	if (!root1 || !root2) return FALSE;
	if (!kids && !sibs) return equal_node(root1, root2);
	if ( kids && !sibs)
		return equal_node(root1, root2) && iso_nodes(nchild(root1),
		    nchild(root2), 1, 1);
	len1 = length_nodes(root1);
	len2 = length_nodes(root2);
	if (len1 != len2) return FALSE;
	if (len1 == 0) return TRUE;
	node1 = root1;
	while (node1) {
		node2 = root2;
		while (node2) {
			if (iso_nodes(node1, node2, kids, 0))
				break;
			node2 = nsibling(node2);
		}
		if (!node2) return FALSE;
		node1 = nsibling(node1);
	}
	return TRUE;
}
BOOLEAN iso_nodes ( NODE root1 , NODE root2 , BOOLEAN kids , BOOLEAN sibs ) { INT len1 , len2 ; NODE node1 , node2 ; if ( ! root1 && ! root2 ) return TRUE ; if ( ! root1 || ! root2 ) return FALSE ; if ( ! kids && ! sibs ) return equal_node ( root1 , root2 ) ; if ( kids && ! sibs ) return equal_node ( root1 , root2 ) && iso_nodes ( nchild ( root1 ) , nchild ( root2 ) , 1 , 1 ) ; len1 = length_nodes ( root1 ) ; len2 = length_nodes ( root2 ) ; if ( len1 != len2 ) return FALSE ; if ( len1 == 0 ) return TRUE ; node1 = root1 ; while ( node1 ) { node2 = root2 ; while ( node2 ) { if ( iso_nodes ( node1 , node2 , kids , 0 ) ) break ; node2 = nsibling ( node2 ) ; } if ( ! node2 ) return FALSE ; node1 = nsibling ( node1 ) ; } return TRUE ; }
iso_nodes -- See if two node structures are isomorphic
iso_nodes -- See if two node structures are isomorphic