any node in list1 or list2 and not in the other gets a score of -INFINITY */
| 55 | |
| 56 | /* any node in list1 or list2 and not in the other gets a score of -INFINITY */ |
| 57 | void |
| 58 | node_list_exclude(GHashTable * hash, GListPtr list, gboolean merge_scores) |
| 59 | { |
| 60 | GHashTable *result = hash; |
| 61 | node_t *other_node = NULL; |
| 62 | GListPtr gIter = list; |
| 63 | |
| 64 | GHashTableIter iter; |
| 65 | node_t *node = NULL; |
| 66 | |
| 67 | g_hash_table_iter_init(&iter, hash); |
| 68 | while (g_hash_table_iter_next(&iter, NULL, (void **)&node)) { |
| 69 | |
| 70 | other_node = pe_find_node_id(list, node->details->id); |
| 71 | if (other_node == NULL) { |
| 72 | node->weight = -INFINITY; |
| 73 | } else if (merge_scores) { |
| 74 | node->weight = merge_weights(node->weight, other_node->weight); |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | for (; gIter != NULL; gIter = gIter->next) { |
| 79 | node_t *node = (node_t *) gIter->data; |
| 80 | |
| 81 | other_node = pe_hash_table_lookup(result, node->details->id); |
| 82 | |
| 83 | if (other_node == NULL) { |
| 84 | node_t *new_node = node_copy(node); |
| 85 | |
| 86 | new_node->weight = -INFINITY; |
| 87 | g_hash_table_insert(result, (gpointer) new_node->details->id, new_node); |
| 88 | } |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | GHashTable * |
| 93 | node_hash_from_list(GListPtr list) |
no test coverage detected