File Exchange

image thumbnail

MATLAB - GraphViz interface

version 1.0 (15.6 KB) by

Interface GraphViz graph layout and MATLAB user interface power.

17 Ratings



View License

Feb 2004 Massachusetts Institute of Technology, AI Lab
MATLAB <-> GraphViz by Dr. Leon Peshkin: pesha @ |

this is a README file for `ad hoc' MATLAB package created to interface AT&T GraphViz graph layout and MathWorks MATLAB user Interface powers. Please make sure you have both MATLAB and GraphViz properly installed on your system. The package works on Unix and even on Windows. Use at your own risk.

README - this file
graph_to_dot.m - Creates a GraphViz formated file from a graph given by an adjacency matrix.
dot_to_graph.m - Extracts an adjacency matrix, node labels, and layout from a GraphViz file.
graph_draw.m - Draws a graph in MATLAB with a given layout
make_layout.m - used to do a lame layout in case no layout is fed to graph_draw
draw_dot.m - a sample code illustrating use of package functions.
draws a graph defined by adjacency matrix, by
-first converting it to a GraphViz file (graph_to_dot)
-then calling NEATO of GraphViz to do a layout
-then importing layout file back into Matlab (dot_to_graph)
-finally calling graph_draw to display the layout
sample_click.m - an auxiliary sample code which allows to right-mouse-click on the nodes of
a graph to call a dummy function currently just printing that node's label
my_setdiff.m - my version of setdiff() which works much faster

Comments and Ratings (19)

Hi, I am having this error can some one help?

Error using textread (line 165)
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 30)
[trash, names, x, y] = dot_to_graph(tmpLAYOUT); % load NEATO layout

Error in ggwp (line 6)
[x,y] = draw_dot(G);

Kim Jaekwan


Wilmer (view profile)

I try to run sample_click.m, but I have the error:
??? Error: File: sample_click.m Line: 7 Column: 1
Function definitions are not permitted in this context.


??? Undefined function or variable 'range'.
I replaced range with max(x)-min(x) and i worked!

Shicai Yang

[node_pos] = sscanf(line(pos_pos:length(line)), ' pos = "%f,%f"')';

it does work. thank you.

Marco Canini

I found a bug on line 92 of dot_to_graph.m. The original uses %d in the sscanf but it should be like this:
[node_pos] = sscanf(line(pos_pos:length(line)), ' pos = "%f,%f"')';

Mark Bolan

Matlab keeps indicating error: neato command not found. How do I resolve this issue?

Valentina Rossetti

I was just looking for something like that - thank you, it's very nice!

Yuri Medvedev

Highly professional work.

Michael Jachan

i rely on it :)

Stephen Cowen

Good. Definitely Beta, but good. Would be nice if it had a demo script that would generate some sample graphs to illustrate the functions.

son hong


Jing Tang

excellent work! I will use it in my project..

Etienne Lefebvre

Sébastien Vast

Very interesting tools but lack of certain
features for my usage in biochemical network
But it is easy to add these

Koni Wolka

I wish this came as a toolbox from Matlab!
Great job!

Nick Henderson

I have been using the tool to visualize gene networks. I found and fixed a small bug in graph_to_dot. I have already emailed the author. But, for the time being you may use this link:

Other than that, I am a big fan of Graphviz and the matlab interface!

Ben Zana


Nick Valuy

long awaited tool, must be a standard distr.


arc lables; other minor changes
like isolated nodes.

MATLAB Release
MATLAB 6.1 (R12.1)

Inspired: MATLAB GraphViz Layout importer

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video