Skip to content

UndirectedGraph

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

UndirectedGraph

The UndirectedGraph<TVertex, TEdge> provides an efficient data structure to access the adjacent-edges of a vertex of undirected graphs.

This class is mutable, serializable, cloneable and can be constructed in many different ways. Internally, the data structure keeps a dictionary from TVertex to a unordered list of TEdge elements.

var graph = new UndirectedGraph<int, Edge<int>>();
...
foreach(int vertex in graph.Vertices)
{
    foreach(Edge<int> edge in graph.AdjacentEdges(vertex))
    {
        Console.WriteLine(edge);
    }
}