Graphs should be groups of vertices #3

Closed
D4L opened this Issue Dec 28, 2012 · 2 comments

Comments

Projects
None yet
2 participants
Owner

D4L commented Dec 28, 2012

A graph should be able to add, find, and remove vertices.

recommended ruby example:

myGraph = Graph.new               #=> myGraph
myGraph.addVertex "MyVertex"      #=> myGraph ( has vertex included )
myGraph.hasVertex? "MyVertex"     #=> true
myGraph.removeVertex "MyVertex"   #=> myGraph ( myGraph unchanged )
myGraph.removeVertex! "MyVertex"  #=> myGraph ( myGraph changed )

ksdnlee commented Dec 30, 2012

I suggest using underscores instead of camel case when working with method names. See Ruby coding conventions for more detail.

Example of change:

myGraph.add_vertex "MyVertex"      #=> myGraph ( has vertex included )
Owner

D4L commented Dec 31, 2012

Noted. Also, changing keyword remove to delete, because we aren't really keeping an instance of the vertex around after we "remove" it.

myGraph.delete_vertex "MyVertex"
myGraph.delete_vertex! "MyVertex"

@D4L D4L added a commit that referenced this issue Jan 2, 2013

@D4L D4L Add 'has_vertex' to Graph. Part of #3 fa99fbc

D4L closed this in 869a597 Jan 4, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment