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 4621740
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:44:42+00:00 2026-05-22T02:44:42+00:00

the following code produces the graph above: digraph G { //—graph config fontname=Helvetica rankdir

  • 0

enter image description here

the following code produces the graph above:

digraph G {


//---graph config

    fontname=Helvetica

    rankdir = RL
    splines = polyline
    compound = true
    //concentrate = true

    labeljust = c
    labelloc = t

    ranksep=0.5
    nodesep=0.5

    //size="10,10"
    ratio=compress

    edge [
        minlen=1
        arrowsize=0.75
        labeldistance=5     

        fontname=Helvetica
        fontsize=12
        fontcolor=black     

        labelfontsize=12
        labelfontcolor=red
        labelfontname=Helvetica


        ]


    node [
        fontname=Helvetica
        fontsize=12
        fontcolor=black

        regular=true
        shape=diamond
        // width=0.25
        // height=0.25
        ]



// --- # nodes  

{// records
node [shape=record, width=1]


b10 [label="  { R-7 | 5 } | B/10  "]
b20 [label="  { R-6 | 10 } | B/20  "]
b30 [label="  { R-5 | 10 } | B/30  "]
d10 [label="  { R-10 | 15 } | D/10  "]
d20 [label="  { R-9 | 10 } | D/20  "]
d30 [label="  { R-8 | 10 } | D/30  "]
a20 [label="  { R-2 | 5 } | A/20  "]
a30 [label="  { R-1 | 10 } | A/30  "]

}

{// circles
node [shape=circle]
e [label="E"]
c [label="C"]
}

{// box
node [shape=box]
a [label="A"]
}


//--- # edges

{
edge [weight = 1000] 

//straight
c -> b10 -> b20 -> b30
e -> d10 -> d20 -> d30
a20 -> a30 -> a

//combination
{b30 d30} -> a20
}


//--- # Clusters 

// subgraph cluster_1{
// label="a "
// e d10 d20
// }

// subgraph cluster_2{
// label="b "
// c b10 b20 b30
// }

// subgraph cluster_3{
// label="c "
// a30 a20
// }



// --- # bugfixes

{// c before e
edge [style=invis] 
c -> e


{rank=source e c} // force same rank before other nodes
}



}

This is exactly as nice and clean as I want it to be.
However, I want to be able to mark and comment certain sections of the structure and I thouht clusters should be the right means to do that.

If you uncomment the CLUSTERS section of the code you get the following code and respective graph:

digraph G {


//---graph config

    fontname=Helvetica

    rankdir = RL
    splines = polyline
    compound = true
    //concentrate = true

    labeljust = c
    labelloc = t

    ranksep=0.5
    nodesep=0.5

    //size="10,10"
    ratio=compress

    edge [
        minlen=1
        arrowsize=0.75
        labeldistance=5     

        fontname=Helvetica
        fontsize=12
        fontcolor=black     

        labelfontsize=12
        labelfontcolor=red
        labelfontname=Helvetica


        ]


    node [
        fontname=Helvetica
        fontsize=12
        fontcolor=black

        regular=true
        shape=diamond
        // width=0.25
        // height=0.25
        ]



// --- # nodes  

{// records
node [shape=record, width=1]


b10 [label="  { R-7 | 5 } | B/10  "]
b20 [label="  { R-6 | 10 } | B/20  "]
b30 [label="  { R-5 | 10 } | B/30  "]
d10 [label="  { R-10 | 15 } | D/10  "]
d20 [label="  { R-9 | 10 } | D/20  "]
d30 [label="  { R-8 | 10 } | D/30  "]
a20 [label="  { R-2 | 5 } | A/20  "]
a30 [label="  { R-1 | 10 } | A/30  "]

}

{// circles
node [shape=circle]
e [label="E"]
c [label="C"]
}

{// box
node [shape=box]
a [label="A"]
}


//--- # edges

{
edge [weight = 1000] 

//straight
c -> b10 -> b20 -> b30
e -> d10 -> d20 -> d30
a20 -> a30 -> a

//combination
{b30 d30} -> a20
}


//--- # Clusters 

subgraph cluster_1{
label="a "
e d10 d20
}

subgraph cluster_2{
label="b "
c b10 b20 b30
}

subgraph cluster_3{
label="c "
a30 a20
}



// --- # bugfixes

{// c before e
edge [style=invis] 
c -> e


{rank=source e c} // force same rank before other nodes
}



}

enter image description here

As you can see from the bugfixes section at the end of the code I want nodes C and E definitely to appear with the same rank ‘above’ all other nodes.

Furhtermore, I want the upper and lower sequence of records to be connected with nice straight lines like in the first example. The weight of the edges that I introduced does not help.

Does anyone know how to fix this problem and how to make graphviz produce a nice clean graph as in example #1 with just 3 embracing boxes and respective labels added?

  • 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-05-22T02:44:43+00:00Added an answer on May 22, 2026 at 2:44 am

    I tried to only modify what was needed:

    • Added an additional cluster without label and style=invis (for d30)
    • Changed the order of the nodes to have cluster b above cluster a
    • Edge weigth removed
    • Bugfixes section removed
    • Some linebreaks removed

    Here’s what I get with a recent graphviz version (2.29):

    enter image description here

    Not perfect, but a lot closer.

    digraph G {
    //---graph config
    
        fontname=Helvetica
    
        rankdir = RL
        splines = polyline
        compound = true
        //concentrate = true
    
        labeljust = c
        labelloc = t
    
        ranksep=0.5
        nodesep=0.5
    
        //size="10,10"
        ratio=compress
    
        edge [
            minlen=1
            arrowsize=0.75
            labeldistance=5     
    
            fontname=Helvetica
            fontsize=12
            fontcolor=black     
    
            labelfontsize=12
            labelfontcolor=red
            labelfontname=Helvetica
            ]
    
        node [
            fontname=Helvetica
            fontsize=12
            fontcolor=black
    
            regular=true
            shape=diamond
            // width=0.25
            // height=0.25
            ]
    
    // --- # nodes  
    
    {// records
    node [shape=record, width=1]
    
    d10 [label="  { R-10 | 15 } | D/10  "]
    d20 [label="  { R-9 | 10 } | D/20  "]
    d30 [label="  { R-8 | 10 } | D/30  "]
    b10 [label="  { R-7 | 5 } | B/10  "]
    b20 [label="  { R-6 | 10 } | B/20  "]
    b30 [label="  { R-5 | 10 } | B/30  "]
    a20 [label="  { R-2 | 5 } | A/20  "]
    a30 [label="  { R-1 | 10 } | A/30  "]
    }
    
    {// circles
    node [shape=circle]
    e [label="E"]
    c [label="C"]
    }
    
    {// box
    node [shape=box]
    a [label="A"]
    }
    
    //--- # edges
    
    {
    
    //straight
    c -> b10 -> b20 -> b30
    e -> d10 -> d20 -> d30
    a20 -> a30 -> a
    
    //combination
    {b30 d30} -> a20}
    
    //--- # Clusters 
    
    
     subgraph cluster_1{
     label="a "
     e d10 d20
     }
    
     subgraph cluster_2{
     label="b "
     c b10 b20 b30
     }
    
     subgraph cluster_3{
     label="c "
     a30 a20
     }
    
     subgraph cluster_4{
     label=""
     style=invis
     d30
     }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Following code produces a nested array as a result for keys containing three items:
The following code produces no suitable constructor found error. I am unable to figure
The following code produces wrong and inconsistent output with gcc (4.1.2 20080704) but correct
The following code produces a ListView with the names of the customers: private void
The following code produces the result I don't understand this. Any ideas why? If
Can anyone tell me why the following code produces the alert box that I
I have the following code that produces a background image in a table cell.
Given the following code: var a = 'somegarbage=http://somesite.com/foo/bar/&moregarbage'; var result = a.match(/http.+\//g); Produces the
Help me translate following block of the Haskell code. The run function produces text
The following code produces the output xyz a = %w{x y z} print a.to_s

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.