Closed D4L closed 11 years ago
Allow users to ask a vertex what it's adjacent to. In other words, which other vertices it is connected by an edge with.
Assume graph is the 4-cycle ( { v1, v2, v4, v8 }, { edges formed with sum (e##) } )
graph
graph.is_adjacent?( "v1", "v2" ) # => true graph.is_adjacent?( "v1", "v4" ) # => false graph.adjacency_list "v4" # => [ "v2", "v8" ]
Vertex Adjacency
Task
Allow users to ask a vertex what it's adjacent to. In other words, which other vertices it is connected by an edge with.
Content
Example
Assume
graph
is the 4-cycle ( { v1, v2, v4, v8 }, { edges formed with sum (e##) } )