Changeset 594 for mds-and-trees
- Timestamp:
- 08/23/16 18:13:31 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
mds-and-trees/tree-genealogy.py
r589 r594 65 65 from_col = [100, 70, 0] 66 66 to_col = [60, 0, 0] 67 from_col = [0, 0, 0]68 to_col = [80, 0, 80]69 67 # lava 70 68 # from_col = [100, 80, 0] … … 295 293 dot_style = svg_clear_dot_style #svg_generate_dot_style(depth[c]/max_depth) 296 294 svg_add_dot( (w_margin+w_no_margs*(positions[c][0]-min_width)/(max_width-min_width), h_margin+h_no_margs*positions[c][1]/max_height), dot_style) 295 #svg_add_text( str(depth[c]), (w_margin+w_no_margs*(positions[c][0]-min_width)/(max_width-min_width), h_margin+h_no_margs*positions[c][1]/max_height), "end") 297 296 def draw_children(): 298 297 global visited … … 314 313 315 314 def draw_spine_recurrent(node): 315 global visited 316 316 for c in inv_nodes[node]: 317 318 # we want to draw the node just once 319 if all_parents_visited(c): 320 visited[c] = True 321 322 if depth[c] == depth[node] - 1: 323 if c in inv_nodes: 324 draw_spine_recurrent(c) 325 317 326 if depth[c] == depth[node] - 1: 318 if c in inv_nodes:319 draw_spine_recurrent(c)320 321 327 line_style = svg_spine_line_style 322 328 svg_add_line( (w_margin+w_no_margs*(positions[node][0]-min_width)/(max_width-min_width), h_margin+h_no_margs*positions[node][1]/max_height), 323 329 (w_margin+w_no_margs*(positions[c][0]-min_width)/(max_width-min_width), h_margin+h_no_margs*positions[c][1]/max_height), line_style) 324 330 #svg_add_dot( (w_margin+w_no_margs*(positions[c][0]-min_width)/(max_width-min_width), h_margin+h_no_margs*positions[c][1]/max_height), svg_spine_dot_style) 325 331 def draw_spine(): 332 global visited 333 visited = {} 334 visited[firstnode] = True 335 326 336 draw_spine_recurrent(firstnode) 327 337 #svg_add_dot( (w_margin+w_no_margs*(positions[firstnode][0]-min_width)/(max_width-min_width), h_margin+h_no_margs*positions[firstnode][1]/max_height), svg_spine_dot_style) 328 338 329 def draw_skeleton_reccurent(node, max_depth): 339 def draw_skeleton_reccurent(node): 340 global visited 330 341 for c in inv_nodes[node]: 331 if depth[c] >= min_skeleton_depth or depth[c] == max([depth[q] for q in inv_nodes[node]]): 332 if c in inv_nodes: 333 draw_skeleton_reccurent(c, max_depth) 334 342 343 if all_parents_visited(c): 344 visited[c] = True 345 346 if depth[c] >= min_skeleton_depth: # or depth[c] == max([depth[q] for q in inv_nodes[node]]): 347 if c in inv_nodes: 348 draw_skeleton_reccurent(c) 349 350 if depth[c] >= min_skeleton_depth: # or depth[c] == max([depth[q] for q in inv_nodes[node]]): 351 #print([depth[q] for q in inv_nodes[node]]) 335 352 line_style = svg_spine_line_style 336 353 svg_add_line( (w_margin+w_no_margs*(positions[node][0]-min_width)/(max_width-min_width), h_margin+h_no_margs*positions[node][1]/max_height), … … 339 356 # svg_spine_dot_style) 340 357 def draw_skeleton(): 341 max_depth = 0342 for k, v in depth.items():343 max_depth = max(max_depth, v)344 345 draw_skeleton_reccurent(firstnode , max_depth)358 global visited 359 visited = {} 360 visited[firstnode] = True 361 362 draw_skeleton_reccurent(firstnode) 346 363 #svg_add_dot( (w_margin+w_no_margs*(positions[firstnode][0]-min_width)/(max_width-min_width), h_margin+h_no_margs*positions[firstnode][1]/max_height), 347 364 # svg_spine_dot_style)
Note: See TracChangeset
for help on using the changeset viewer.