Quantcast
Viewing all articles
Browse latest Browse all 25

Created Unassigned: Implementation of OutEdges(TVertex v) for BidirectionalGraph is (I think) wrong [65208]

Here is the implementation for BidirectionalGraph :
```
public IEnumerable<TEdge> OutEdges(TVertex v)
{
IEnumerable<TEdge> result;
if (this.TryGetInEdges(v, out result))
return result;
else
return Enumerable.Empty<TEdge>();
}
```
I think it should not use the method "TryGetInEdges".

A symptom of this problem is that the algoritms have a weird behaviour. For exemple, is i have the following graph:
```
v1->v2
^ |
| v
v4<-v3
```
and if I use the StronglyConnectedComponents algorithm on this graph, the algorithm will output that there is 4 components (we should have only one component). I think, this is because the StronglyConnectedComponents algorithm use the OutEdges method, and since it is wrong, the algorithm actually see the following graph:
```
|-------| |-------| |-------| |-------|
v1<---| v2<---| v3<---| v4<---|
```
(each vertex has a self-loop, and there is no other edge excepts these loops)

Viewing all articles
Browse latest Browse all 25

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>