Skip to main content
. 2019 Nov 20;39(11):1287–1292. [Article in Chinese] doi: 10.12122/j.issn.1673-4254.2019.11.04
Algorithm 1: Building algorithm of the maximum spanning tree Ti(i∈[0,C-1]).
Input: undirected weighted graph Ui(Vi,Ei), upper level maximum spanning tree Ti-1(VTi-1,ETi-1), the number of mutations in Mi is ni. Output:maximum spanning tree Ti(VTi,ETi) and the haplotypes of sub-clone Si.
1. if(i=0){ //Initialization,set the number of mutations in Vi is Nv
2. Initializing flag array f[Nv]: for(v=1;v≤Nv;v++)f[v]=0;
3. Randomly selecting a vertex sp in the graph Ui as starting point of reconstructing clonal haplotypes;
4. ni--;
5. Initializing the maximum spanning tree Ti: the vertex set is VTi={sp}, the edge set is ETi={ET0} andf[sp] =1;
6. } else {
7. Initializing flag array f[Nv]: for(v=1;v≤Nv;v++){if(v∈VTi-1)f[v]=1; elsef[v]=0; }
8. Initializing maximum spanning tree Ti:VTi=VTi-1,ETi=ETi-1;
9. }
10. for(j=1;j≤ni;j++) {
11. Finding all the edges about (pu,pv) that (pu∈VTi∧pv∈Vi-VTi) from graph Ui;
12. Selecting edge (pu,pv) with max(|w(pu,px)|) to add into the edge set ETi of Ti,pv is added into vertex VTi;
13. Determine the base state of pv according to the sign of w(pu,pv);
14. Updating f[pv] with 1;
15. }
16 End of algorithm, attaining the maximum spanning treeTi.