Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8595871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:32:33+00:00 2026-06-12T00:32:33+00:00

I am trying to force the nodes to have a specified position in the

  • 0

I am trying to force the nodes to have a specified position in the graph. While doing so, the different sub-graphs are not aligned properly. The code to generate this graph is :

digraph {
rankdir=LR;
labeljust="l";

subgraph cluster0{

label="t=0" 


n_3_0_0[label="192.168.8.6"
    pos="15,12!"    
    ];
n_3_0_1[label="192.168.8.3"
    pos="10,10!"    
    ];

 n_3_0_0 -> n_3_0_1 ;
 n_3_0_1 -> n_3_0_0 ;
};

subgraph cluster1{

label="t=5"     

n_3_1_0[label="192.168.8.6"
    pos="15,12!"    
    ];
n_3_1_1[label="192.168.8.3"
    pos="10,10!"    
    ];
n_3_1_2[label="192.168.8.9"
    pos="10,12!"    
    ];

 n_3_1_0 -> n_3_1_1 ;
 n_3_1_1 -> n_3_1_0 ;
};


subgraph cluster2{

label="t=10" 

n_3_2_0[label="192.168.8.6"
    pos="14,10!"    
    ];
n_3_2_1[label="192.168.8.3"
    pos="10,10!"    
    ];
n_3_2_2[label="192.168.8.9"
    pos="15,11!"    
    ];
n_3_2_3[label="192.168.8.8"
    pos="18,12!"    
    ];

 n_3_2_0 -> n_3_2_1 ;

 n_3_2_2 -> n_3_2_3 ;
 n_3_2_1 -> n_3_2_0 ;
 n_3_2_3 -> n_3_2_2 ;
};

}

I compiled this code by forcing the node position:

dot -Kfdp -n -Tpng -o sample.png test2.dot

The output graph is:
http://imageshack.us/photo/my-images/826/samplebg.png/
The problem with the output I got is:
1. the subgraph are NOT displayed in sequence of t=0, t-5, t=10…
2. the subgraph are NOT aligned to left.

I need to have output graph like this:
http://imageshack.us/photo/my-images/253/needed.png/

Thnak You.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:32:35+00:00Added an answer on June 12, 2026 at 12:32 am

    Since you already precalculated the positions of all the nodes, you don’t really need fdp – you just nead a layout which respects the pos attribute.

    So you could generate the output like this:

    neato -Tpng sourcedot.gv -O
    

    But you’d have to adjust node positions before that, in order to have the subgraphs correctly stacked and not super-posed:

    digraph {
    rankdir=LR;
    labeljust="l";
    
    subgraph cluster0{
    label="t=0"
    n_3_0_0[label="192.168.8.6"
        pos="15,4!"
        ];
    n_3_0_1[label="192.168.8.3"
        pos="10,2!"
        ];
    
     n_3_0_0 -> n_3_0_1 ;
     n_3_0_1 -> n_3_0_0 ;
    };
    
    subgraph cluster1{
    label="t=5"
    n_3_1_0[label="192.168.8.6"
        pos="15,7!"
        ];
    n_3_1_1[label="192.168.8.3"
        pos="10,5!"
        ];
    n_3_1_2[label="192.168.8.9"
        pos="10,7!"
        ];
    
     n_3_1_0 -> n_3_1_1 ;
     n_3_1_1 -> n_3_1_0 ;
    };
    
    
    subgraph cluster2{
    label="t=10"
    n_3_2_0[label="192.168.8.6"
        pos="14,8!"
        ];
    n_3_2_1[label="192.168.8.3"
        pos="10,8!"
        ];
    n_3_2_2[label="192.168.8.9"
        pos="15,9!"
        ];
    n_3_2_3[label="192.168.8.8"
        pos="18,10!"
        ];
    
     n_3_2_0 -> n_3_2_1 ;
    
     n_3_2_2 -> n_3_2_3 ;
     n_3_2_1 -> n_3_2_0 ;
     n_3_2_3 -> n_3_2_2 ;
    };
    
    }
    

    Resulting in

    enter image description here
    (Some minor adjustments still needed for the label of the middle subgraph)

    Or just use dot and let it align the nodes, too:

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm trying to force a div to have a certain height depending on his
I have a stupid WinCE application where I'm just trying to force an exception
I have been trying to force images to download using PHP Headers but there
I have been working on JUNG2 for a while now, trying to visualize a
I have asp.net grid view to display techs notes. I am trying to force
I am trying to create a d3 force-directed graph ( http://mbostock.github.com/d3/ex/force.html ). Here is
I am trying to add Tipsy hover-over popups to my simple force-directed graph of
I'm trying to add in a double click on a node in the force
I am trying to force HTTPS on a domain. It must be done using
I'm trying to force an inherited class to use a custom attribute. I'm creating

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.