Ok.

After generating a long graph, I use linspace function to generate positions
for the main paths of the graph. So I fixed these positions using the pin
property. But after calling the function sfdp_layout all positions are
changed. Is this the expected behavior? I presented the results in the
previous post. Here is my relevant code:

    pin = g.new_vertex_property("bool")
    pos = g.new_vertex_property("vector<double>")   
    v_c = g.new_vertex_property("double")
    v_s = g.new_vertex_property("int")  
       
    # I created a graph with 11000 nodes.
        
    # setting positions for the main path 
    position = np.linspace(0.0, 12.0, main_path_size)
    for i,idx in enumerate(main_path_i):
        pin[g.vertex(idx)] = True              
        pos[g.vertex(idx)] = (0, position[i])  
        v_c[g.vertex(idx)] = 50                # color
        v_s[g.vertex(idx)] = 10                # size
    
    # setting positions for the second main path   
    position = np.linspace(0.0, 12.0, sec_path_size)
    for i,idx in enumerate(sec_path_i):
        pin[g.vertex(idx)] = True          
        pos[g.vertex(idx)] = (position[i], 12.0)  
        v_c[g.vertex(idx)] = 250  # color
        v_s[g.vertex(idx)] = 10 # size
        
    # setting positions for the thirmain path   
    position = np.linspace(0.0, 12.0, thi_path_size)
    for i,idx in enumerate(thi_path_i):
        pin[g.vertex(idx)] = True          
        pos[g.vertex(idx)] = (-position[i], 12.0)  
        v_c[g.vertex(idx)] = 350 # color
        v_s[g.vertex(idx)] = 10 # size            
       
    # calling the layout function
    pos = gt.sfdp_layout(g, pin=pin, pos=pos)
    
    gt.graph_draw(g, pos, output_size=(1000, 1000), vertex_fill_color=v_c,
vertex_size=v_s, vcmap=mat.cm.jet, output='mxt.png', fmt='png')
    




--
View this message in context: 
http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Fixing-position-of-root-vertex-tp4025773p4025886.html
Sent from the Main discussion list for the graph-tool project mailing list 
archive at Nabble.com.
_______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to