Skip to content

Instantly share code, notes, and snippets.

@toraritte
Last active September 14, 2021 01:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save toraritte/e19e732dc827c629bfb318064384743a to your computer and use it in GitHub Desktop.
Save toraritte/e19e732dc827c629bfb318064384743a to your computer and use it in GitHub Desktop.
Annotated GraphViz code for https://medium.com/p/d6c4c234c4ee
digraph sameaddress {
///////////////////////////////////////
// Global setup
///////////////////////////////////////
node [shape=record];
rankdir=LR;
//ranksep=1;
nodesep=0.5;
splines=polyline;
///////////////////////////////////////
// Node list
///////////////////////////////////////
logan [label="PERSON|Logan" ];
kilgore [label="PERSON|Kilgore" ];
sn1 [label="STREET_NUMBER|27" ];
sn2 [label="STREET_NUMBER|27" ];
unit1 [label="UNIT|Apt 7A" ];
unit2 [label="UNIT|Apt 7A" ];
street1 [label="STREET|Cake street" ];
street2 [label="STREET|Cake street" ];
city1 [label="CITY|Isalie" ];
city2 [label="CITY|Mabase" ];
county [label="COUNTY|Lassen" ];
///////////////////////////////////////
// Adding edges
///////////////////////////////////////
logan -> unit1 [label="rents" ];
unit1 -> logan [label="address_of" ];
unit1 -> logan [label="primary_address_of" ];
unit1 -> kilgore [headlabel="primary_address_of", labeldistance=7,labelangle=7 ];
unit1 -> kilgore [label="address_of" ];
kilgore -> unit2 [label="owns" ];
unit2 -> kilgore [label="address_of" ];
unit1 -> sn1 [label="unit_of"];
unit2 -> sn2 [label="unit_of"];
sn1 -> street1 [label="street_number_on"];
sn2 -> street2 [label="street_number_on"];
street1 -> city1 [label="street_in"];
street2 -> city2 [label="street_in"];
city1 -> county [label="city_in"];
city2 -> county [label="city_in"];
///////////////////////////////////////
// Anonym subgraph to enforce ordering
///////////////////////////////////////
{
node [style="invis"];
edge [style="invis"];
A -> B -> C;
{rank=same; A; kilgore; logan; }
{rank=same; B; unit1; unit2; }
{rank=same; C; street1; street2; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment