int move(struct node*curr) { if(activelength>=edgelength(curr)) { activeedge+=edgelength(curr); activelength-=edgelength(curr); activenode=curr; return 1; } return 0; }
int dotra(struct node*n,int label,int *maxm,int*suffix) { if(n==NULL)return ; int i=0; if(n->index==-1) { for(i=0;i<27;i++) { if(n->child[i]!=NULL) { dotra(n->child[i],label+edgelength(n->child[i]),maxm,suffix); } } } else if(n->index>-1&&(*maxm<label-edgelength(n))) { *maxm=label-edgelength(n); *suffix=n->index; } }
void FMMMLayout::call(GraphAttributes &AG) { const Graph &G = AG.constGraph(); EdgeArray<double> edgelength(G,1.0); //edge e; //forall_edges(e,G) // edgelength[e] = 1.0; call(AG,edgelength); }
void display(struct node*n,int label,int leaf) { if(n==NULL)return ; if(n->start!=-1&&leaf!=0)pri(n->start,*(n->end)); leaf=1; int i=0; for(i=0;i<27;i++) { if(n->child[i]!=NULL) { leaf=0; pri(n->start,*(n->end)); display(n->child[i],label+edgelength(n->child[i]),leaf); } } if(leaf==1) { n->index=size-label; pri(n->start,*(n->end)); printf(" [%d]\n",n->index); } }
void FMMMLayout::call(GraphAttributes &GA) { const Graph &G = GA.constGraph(); EdgeArray<double> edgelength(G,1.0); call(GA,edgelength); }