How to generate random graph of n vertices with random connections with specified number of Edge in matlab
16 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
RAMA KRISHNA KOPPANATI
il 3 Dic 2021
Modificato: Matt J
il 4 Dic 2021
Though i have used the below code for generating the random graph of n vertices with random connections, it is even choosing the number of edges randomly. Could some one please help me to find the solution for this?
G = round(rand(n));
G = triu(G) + triu(G,1)';
G = G - diag(diag(G));
Example: n = 5; number of edges = 10
Response:
0 1 0 1 0
1 0 1 0 0
1 1 0 1 0
0 0 1 0 1
0 1 0 0 0
0 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Graph and Network Algorithms in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!