getNumberOfEdges() method for each vertice?

Topics: graph
Sep 28, 2011 at 2:52 PM

I'm trying to build a graph of N vertices, where all vertices are constrained from having more than 3 in/out edges.

In my feeble attempt to do this for the first time using QuickGraph, everything is going fine up until I need to get the number of edges going from each vertex:

Please excuse me for not using the code snippet function (for some reason it doesn't work on my computer)

public void makeGraph(int nodes)
AdjacencyGraph<int, Edge<int>> graph = new AdjacencyGraph<int, Edge<int>>(true);

for (int i = 0; i < nodes; i++)

foreach (var vertice in graph.Vertices)
    while (vertice.getNumberOfEdges < 3)

This is sort of how i imagined it to work, but I can't seem to find how this is really done...