Skip to content

BidirectionalGraphAdapter

Alexandre Rabérin edited this page May 11, 2020 · 1 revision

BidirectionalGraphAdapter

The BidirectionalGraphAdapter<TVertex, TEdge> provides a wrapper around an adjacency graph in order to adpat it as a bidirectional one.

This class is not really mutable, serializable and cloneable.

var graph = new AdjacencyGraph<int, Edge<int>>();
var adapterGraph = new BidirectionalGraphAdapter<int, Edge<int>>(graph);
...
foreach(int vertex in adapterGraph.Vertices)
{
    foreach(Edge<int> edge in graph.InEdges(vertex))
    {
        Console.WriteLine(edge);
    }
}

Depending on your needs it may be interessant to use the BidirectionalGraph.

Clone this wiki locally