Skip to content

Instantly share code, notes, and snippets.

@localhostdotdev
Created May 7, 2019 00:03
Show Gist options
  • Save localhostdotdev/659f4c5371d9a2649cda262141c9a88f to your computer and use it in GitHub Desktop.
Save localhostdotdev/659f4c5371d9a2649cda262141c9a88f to your computer and use it in GitHub Desktop.
Ruby HATBM - Negative Filtering behaving strange, graph https://stackoverflow.com/a/56006045/10993539

graphiz nodes

puts Contact.all.map { |c| "C#{c.id} [style=filled,color=greenyellow]"  } +
  Book.all.map { |b| "B#{b.id} [style=filled,color=lightcyan]" } +
  BookContact.all.map { |bc| "C#{bc.contact_id} -> B#{bc.book_id}" }
digraph G {
C1 [style=filled,color=greenyellow]
C2 [style=filled,color=greenyellow]
C3 [style=filled,color=greenyellow]
C4 [style=filled,color=greenyellow]
C5 [style=filled,color=greenyellow]
C6 [style=filled,color=greenyellow]
C7 [style=filled,color=greenyellow]
C8 [style=filled,color=greenyellow]
C9 [style=filled,color=greenyellow]
C10 [style=filled,color=greenyellow]
B1 [style=filled,color=lightcyan]
B2 [style=filled,color=lightcyan]
B3 [style=filled,color=lightcyan]
B4 [style=filled,color=lightcyan]
B5 [style=filled,color=lightcyan]
B6 [style=filled,color=lightcyan]
C1 -> B1
C2 -> B1
C1 -> B2
C2 -> B2
C3 -> B2
C4 -> B2
C4 -> B3
C5 -> B3
C6 -> B3
C3 -> B4
C4 -> B4
C5 -> B4
C6 -> B4
C1 -> B1
C10 -> B1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment