0

I am trying to put together a family tree to help my understanding of a popular TV show and the project has grown legs.

To illustrate this tree I am using the dot function of graphviz, which is a tool I have used before to illustrate complex networks. Unfortunately for me this was a while ago and some of the basic changes I want to make are eluding me!

In the example below (image at this link), I would like to keep the obvious relationships close together and not have the nodes joined across the canvas. E.g. Sansa and Tyrion together by moving Sansa left, Eddard and Catelyn by moving Catelyn, and Lyanna and Rhaegar by moving Lyanna right.

I have tried clusters and groups, but can't figure out what I am doing wrong.

graph got {

    subgraph gen2 {
        rank = same

        La2a [shape=box, label="Tywin Lanister"];
        Tu2a [shape=box, label="Hoster Tully"];
        S2a [shape=box, label="Rickard Stark"];
        Ta2a [shape=box, label="Aerys II Targaryen"];

    }

    subgraph gen2sons {
        rank = same

        Tu2asons [shape=point];
        S2asons [shape=point];
        Ta2asons [shape=point];
        La2asons [shape=point];

    }

    subgraph gen3 {
        rank = same

        S3a [shape=box, label="Eddard \"Ned\" Stark"];
        S3b [shape=box, label="Catelyn Stark"];
        S3aS3b [shape=point];
        S3c [shape=box, label="Lyanna Stark"];
        S3d [shape=box, label="Brandon Stark"];
        S3e [shape=box, label="Benjen Stark"];

        Ta3a [shape=box, label="Rhaegar Targaryen"];
        Ta3b [shape=box, label="Daenerys Targaryen"];
        Ta3c [shape=box, label="Jaehaerys Targaryen"];
        S3cTa3a [shape=point];

        La3a [shape=box, label="Jamie Lanister"];
        La3b [shape=box, label="Cersei Lanister"];
    }

    subgraph gen3sons {
        rank = same

        S3aS3bsons [shape=point];
        S3cTa3asons [shape=point];

    }

    subgraph gen4 {
        rank = same

        S4b [shape=box, label="Sansa Stark"];
        S4a [shape=box, label="Rob Stark"];
        S4c [shape=box, label="Arya Stark"];
        S4d [shape=box, label="Brandon Stark"];
        S4e [shape=box, label="Rickon Stark"];

        Sn4a [shape=box, label="Jon Snow"];

        La3c [shape=box, label="Tyrion Lanister"];

    }

// Sons and Daughters

    La2a -- La2asons
        La2asons -- La3a
        La2asons -- La3b
        La2asons -- La3c

    Tu2a -- Tu2asons
        Tu2asons -- S3b

    S2a -- S2asons
        S2asons -- S3a
        S2asons -- S3c
        S2asons -- S3d
        S2asons -- S3e

    Ta2a -- Ta2asons
        Ta2asons -- Ta3a
        Ta2asons -- Ta3b
        Ta2asons -- Ta3c

    S3aS3b -- S3aS3bsons
        S3aS3bsons -- S4a
        S3aS3bsons -- S4b
        S3aS3bsons -- S4c
        S3aS3bsons -- S4d
        S3aS3bsons -- S4e

    S3cTa3a -- S3cTa3asons  
        S3cTa3asons -- Sn4a

// Marriage

    S3a -- S3aS3b -- S3b

    La3c -- S4b

    S3c -- S3cTa3a -- Ta3a

}

.png output of the above code

1 Answers1

0

Your graph is lengthy, but this answer of mine from a previous question may shed some light on how to accomplish this with invisible ranks and columns, more or less forcing your nodes into a "grid". I demonstrate in that example with a simpler example, but from what you've already done, I'm sure you're up to trying my approach on your own. Hope it works for you.

TomServo
  • 7,248
  • 5
  • 30
  • 47