bitwalker / bitwalker/libgraph

Graph.edges/2 does not work with bidirectional edges between vertices

Open
#25 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Elixir
Stars
571
Forks
76
PR merge metrics
No merged PRs in 30d

Description

Graph.edges/2 only returns a single direction of edges from one vertex `:a` to another vertex `:b` instead of both directions from the vertex `:a` to the other vertex `:b`.

```
iex(1)> g = Graph.new() |> Graph.add_edges([{:a, :b, label: "label1"}, {:a, :b, label: "label2"}, {:b, :a, label: "label3"}]) |> Graph.edges(:a)
[
%Graph.Edge{label: "label1", v1: :a, v2: :b, weight: 1},
%Graph.Edge{label: "label2", v1: :a, v2: :b, weight: 1}
]
```

Expected:
```
[
%Graph.Edge{label: "label1", v1: :a, v2: :b, weight: 1},
%Graph.Edge{label: "label2", v1: :a, v2: :b, weight: 1},
%Graph.Edge{label: "label3", v1: :b, v2: :a, weight: 1}
]
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.