From 16171a6e61c28479a81de294b8d689ad482ab119 Mon Sep 17 00:00:00 2001 From: Thomas Laptop Date: Mon, 15 Jun 2026 09:49:29 +0200 Subject: [PATCH] - Parent is now assigned correctly to both left and right node. - Diagonal of distance matrix is now initialized to 0, in case of direct indexing (cause of access violation bug) --- src/distancemat.c | 2 +- src/tree.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/distancemat.c b/src/distancemat.c index c83492f..d7aae09 100644 --- a/src/distancemat.c +++ b/src/distancemat.c @@ -259,7 +259,7 @@ struct DistanceMatrix *empty_DistanceMatrix( unsigned int size) { for( i=0; i < mat->size; i++) { mat->data[i] = (Distance *) malloc_util( (i+1) * sizeof(Distance) ); - for( j=0; j < i; j++) + for( j=0; j <= i; j++) mat->data[i][j] = 0.0; } diff --git a/src/tree.c b/src/tree.c index 5b5187f..bde0b2c 100644 --- a/src/tree.c +++ b/src/tree.c @@ -306,7 +306,7 @@ struct Tree *get_root_Tnode( struct Tree *source ) { focal->left = children[focalleft]; focal->right = children[focalright]; - children[focalleft]->parent = children[focalright] = focal; + children[focalleft]->parent = children[focalright]->parent = focal; ret = empty_Tree(); ret->child[0] = root;