Suppose there are 10 nodes in a graph, I need to generate edges between nodes, but there are two conditions to be satisfied:(adsbygoogle = window.adsbygoogle || []).push({});

1) each node can have maximize of two edges.

2) no loop in the graph.

The question is how to run a program which gives an algorithm to generate such a graph randomly?

gim :!!)

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# A question about graph algorithm

**Physics Forums | Science Articles, Homework Help, Discussion**