Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ds/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ def a_random_walk(self, node, length):
return walk
if len(self.graph[node]) == 0:
return walk
if not self.node_choices[node]:
return walk
#*******************
next_node, edge_class_id =random.choice(self.node_choices[node])
walk.append(edge_class_id)
Expand Down
9 changes: 6 additions & 3 deletions model_c/src/hin2vec.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ void DestroyNet() {
void *TrainModelThread(void *id) {
long long a, b, d, w, cur_win, word, node_length = 0;
long long mp_index, edge_length = 0;
char *mp = "";
char *mp;
long long rw_length = 0;
char item[MAX_STRING];
char rw[MAX_RW_LENGTH][MAX_STRING], edge_seq[MAX_RW_LENGTH][MAX_STRING];
Expand All @@ -421,7 +421,9 @@ void *TrainModelThread(void *id) {
exit(1);
}
fseek(fi, file_size / (long long)num_threads * (long long)id, SEEK_SET);


while (fgetc(fi)!=' '&&feof(fi)!=1); // make sure the cursor is not positioned "in" a word

while (1) {
if (word_count - last_word_count > 10000) {
word_count_actual += word_count - last_word_count;
Expand Down Expand Up @@ -501,7 +503,8 @@ void *TrainModelThread(void *id) {
if (has_circle) continue;
}

mp = edge_seq[a];
char mp[MAX_STRING]={0};
strcpy(mp,edge_seq[a]);
for (b=1; b<w; b++) {strcat(mp, edge_seq[a+b]);}

mp_index = SearchMpVocab(mp);
Expand Down