Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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