monora/rgl

Vertices with duplicated labels not shown in DOT visualisation

louismrose opened this issue · 2 comments

Suppose we have the following graph containing 3 vertices:

class Person
  attr_reader :name
  def initialize(name)
    @name = name
  end

  def to_s
    name
  end
end

dg=RGL::DirectedAdjacencyGraph.new
dg.add_vertex(Person.new("Alice"))
dg.add_vertex(Person.new("Bob"))
dg.add_vertex(Person.new("Alice"))

When the graph is visualised via dg.write_to_graphic_file('jpg') it has only two vertices:

graph

Thank you for this patch. I added Graph#vertex_label to be more flexible for showing graph vertex labels.

Looks great -- thanks. And thanks for maintaining this fantastic gem!