Walking Graphs - KeRNeLith/QuikGraph GitHub Wiki
Walking Graphs
Iterate vertices
Use the Vertices
property to get an enumerable collection of vertices:
foreach(var vertex in graph.Vertices)
{
Console.WriteLine(vertex);
}
Iterate edges
Use the Edges
property get an enumerable collection of edges:
foreach(var edge in graph.Edges)
{
Console.WriteLine(edge);
}
Iterate out-edges (in-edges)
The OutEdges
method returns an enumerable collection of out-edges:
foreach(var vertex in graph.Vertices)
{
foreach(var edge in graph.OutEdges(vertex))
{
Console.WriteLine(edge);
}
}
Similarly, InEdges
returns an enumerable collection of in-edges.