bitwalker / libgraph

A graph data structure library for Elixir projects
MIT License
524 stars 75 forks source link

Graph.edges/2 broken? #7

Closed wanderanimrod closed 6 years ago

wanderanimrod commented 6 years ago

Hello @bitwalker , thanks for this lib.

I have been using it and found that Graph.edges/2 does not return edges attached to vertices that don't have only inbound or outbound vertices (but not both).

Example

iex> g = Graph.new |> Graph.add_edges([{:a, :b}, {:b, :c}])
#Graph<type: directed, vertices: [:a, :b, :c], edges: [:a -> :b, :b -> :c]>

All edges are present, as expected.

iex> Graph.edges(g)
[%Graph.Edge{label: nil, v1: :a, v2: :b, weight: 1},
 %Graph.Edge{label: nil, v1: :b, v2: :c, weight: 1}]

I expected this to return [%Graph.Edge{label: nil, v1: :a, v2: :b, weight: 1}] but it returns an empty list

iex> Graph.edges(g, :a)
[ ]

Same thing here

iex> Graph.edges(g, :c)
[ ]

Is this expected behaviour? (Using version 0.11.1)

wanderanimrod commented 6 years ago

Hello @bitwalker , any updates on this?

bitwalker commented 6 years ago

Fixed in master, I'll push a new release soon.

wanderanimrod commented 6 years ago

Thanks.

On Fri, Dec 1, 2017, 9:41 PM Paul Schoenfelder notifications@github.com wrote:

Fixed in master, I'll push a new release soon.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bitwalker/libgraph/issues/7#issuecomment-348662092, or mute the thread https://github.com/notifications/unsubscribe-auth/ADi-KkJf1RuHXptSfAL-laB2Zi66cpm2ks5s8LjCgaJpZM4P5iPj .

-- Wandera Nimrod, Software Developer ThoughtWorks Inc, New York, NY