I'm assuming you're looking for random entries, right? In this Wikipedia article on "random graphs" we cite several different algorithms to generate a graph, each with distinct properties (and different implementation complexity). See "templates" in the information box on the right, on Wikipedia in English there are a few others.
I do not know of any ready-made implementation, but maybe you find something like this in the library LEMON (part of the Boost project) - for C ++ however, not C. And anyway, you would have to "translate" output of any ready-to-format tool you're using to represent, so I do not know what would give more work: use a ready tool, or implement yourself ...
If you decide to implement yourself, the Erdõs-Rényi Template a> seems to be the simplest. In one of its two variants:
Choose a% probability of% between zero and one (zero: no edge, one: fully connected graph);
Create a graph with p
nodes;
For each pair of nodes n
, create or not an edge between them with probability (a,b)
.
Other models produce graphs with different characteristics (eg the Barabási-Albert
20.09.2014 / 20:31