Skip to content

Commit

Permalink
Put spouses (labelled as married) into a subgraph cluster
Browse files Browse the repository at this point in the history
This keeps them together in the layout whereas withotu this change spouses can be arbitrarily far apart.
  • Loading branch information
gdudek authored and vmiklos committed Sep 29, 2024
1 parent 4ee23b1 commit dc6a6de
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ged2dot.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,12 +606,21 @@ def __store_edges(self, stream: BinaryIO) -> None:
if not isinstance(node, Family):
continue
family = node

# Open subgraph of the family.
cname = "cluster_" + family.get_identifier()
stream.write(to_bytes("subgraph " + cname + " { style=invis; \n"))

if family.wife:
from_wife = family.wife.get_identifier() + " -> " + family.get_identifier() + " [dir=none];\n"
stream.write(to_bytes(from_wife))
if family.husb:
from_husb = family.husb.get_identifier() + " -> " + family.get_identifier() + " [dir=none];\n"
stream.write(to_bytes(from_husb))

# Close subgraph of the family.
stream.write(to_bytes("}\n"))

for child in family.child_list:
stream.write(to_bytes(family.get_identifier() + " -> " + child.get_identifier() + " [dir=none];\n"))

Expand Down

0 comments on commit dc6a6de

Please sign in to comment.