Generate Erdos-Renyi graphs with Graphviz

15 views (last 30 days)
A HNG
A HNG on 9 May 2020
Answered: Brandon Sloane on 6 Dec 2021
I'm trying to generate ER graphs using Graphviz from file exchang and I'm getting these errors for these functions:
Error using textread (line 162)
File not found.
Error in dot_to_graph (line 33)
lines = textread(filename,'%s','delimiter','\n','commentstyle','c'); % Read file into cell array of lines
Error in draw_dot (line 22)
[trash, names, x, y] = dot_to_graph(tmpLAYOUT); % load NEATO layout
Error in ggwp (line 6)
[x,y] = draw_dot(G);
My input:
n = 150;
p = log(n)/n;
G = rand(n,n) < p;
G = triu(G,1);
G = G + G';
[x y] = draw_dot(G); % getting error here
gplot(G, [x' y'], '.-');
Wondering if there is any demo on how to use Graphviz? I've downloaded it and have neato but don't know how to use it in MATLAB.

Answers (1)

Brandon Sloane
Brandon Sloane on 6 Dec 2021
Change line 92 of your dot_to_graph.m file as follows:
[node_pos] = sscanf(line(pos_pos:length(line)), ' pos = "%f,%f"')';
This will change them to float variables.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!