X-Git-Url: https://git.octo.it/?p=sort-networks.git;a=blobdiff_plain;f=src%2Fsn_network.h;h=14a36c512a11229c27d1a53e08688ca9fb7f41a6;hp=4626d9d1142c2e422aa39dada45ea1c84c72b403;hb=bb4fb03595cf7334acae6b9d6770115de4b0e731;hpb=518eb323bcc57e22984f75134a6c6b44876d8dd2 diff --git a/src/sn_network.h b/src/sn_network.h index 4626d9d..14a36c5 100644 --- a/src/sn_network.h +++ b/src/sn_network.h @@ -196,6 +196,7 @@ int sn_network_brute_force_check (sn_network_t *n); * \return Zero on success, non-zero on failure. */ int sn_network_show (sn_network_t *n); +int sn_network_show_fh (sn_network_t *n, FILE *fh); /** * Inverts a comparator network by switching the direction of all comparators. @@ -233,6 +234,8 @@ int sn_network_compress (sn_network_t *n); */ int sn_network_normalize (sn_network_t *n); +int sn_network_unify (sn_network_t *n); + /** * Removes an input and all comparators touching that input from the comparator * network. @@ -354,7 +357,21 @@ int sn_network_serialize (sn_network_t *n, char **ret_buffer, */ sn_network_t *sn_network_unserialize (char *buffer, size_t buffer_size); -uint32_t sn_network_get_hashval (const sn_network_t *n); +/** + * Compares two networks and returns zero if they are equal. If they are not + * equal, a number greater than zero or less than zero is returned in a + * consistent matter, so this function can be used to sort networks and detect + * duplicates. It is strongly recommended that you call sn_network_unify() + * before comparing two networks, because they internal structure does matter + * for this function. + * + * \return Zero if the two networks are equal, non-zero otherwise. Return + * values are consistent so this function can be used to sort networks. + * \see sn_network_unify + */ +int sn_network_compare (const sn_network_t *n0, const sn_network_t *n1); + +uint64_t sn_network_get_hashval (const sn_network_t *n); #endif /* SN_NETWORK_H */