View License

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

» Watch video

Highlights from
Plot a Directed Graph

3.3 | 4 ratings Rate this file 17 Downloads (last 30 days) File Size: 2.29 KB File ID: #16131 Version: 1.0
image thumbnail

Plot a Directed Graph


Joseph Kirk (view profile)


28 Aug 2007 (Updated )

plots a directed graph represented by an adjacency matrix and xy points

| Watch this File

File Information

GPLOTD(A,XY) Plots the Directed Graph represented by adjacency matrix A and points xy using the default style described below
GPLOTD(A,XY,PARAM1,VAL1,...) Plots the Directed Graph using valid parameter name/value pairs
A - NxN adjacency matrix, where A(I,J) is nonzero if and only if there is an edge between points I and J
xy - Nx2 matrix of x/y coordinates
... - Parameter name/value pairs that are consistent with valid PLOT parameters can also be specified
Default Plot Style Details:
1. Undirected (2-way) edges are plotted in solid black lines
2. Directed (1-way) edges are plotted in two styles
 a. If the edge connects a larger vertex ID with a smaller ID, the edge is plotted as a blue dashed line
 b. If the edge connects a smaller vertex ID with a larger ID, the edge is plotted as a red dotted line
3. Any vertex that is connected to itself is plotted with a black circle around it


This file inspired Plot A Directed Graph (V2.0).

MATLAB release MATLAB 7.4 (R2007a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (9)
21 Nov 2012 Alexander

I found the GUI a little crude, I found other programmes where the incident matrix is specified far more adaptable and easier to apply

15 Nov 2011 YF

YF (view profile)

02 Nov 2011 Joseph Kirk

Joseph Kirk (view profile)

1. Not sure what you mean by this. There is a '.' Marker used for the nodes.
2. Read the help notes. Rather than using arrows, a different line style is used to represent directed/undirected edges.

Comment only
31 Oct 2011 YF

YF (view profile)

U`ve done amazing work.But actually,there`re 2 prob. 1,no mark of the nodes,don`t know which node represent which vertice;2,no`s not a 'directed' graph

07 May 2010 David Grymin

29 Aug 2007 Doug Harriman

While graphviz is external, Matlab ships with a version of the program. Search for 'mwdot' and 'mwneato' in the bin directory of your install. It provides excellent graph layout functionality.

Comment only
29 Aug 2007 The Author

Scott - I'll consider making an update with your suggested capability.
Kevin - I submit that MATLAB users should not need external software to perform simple tasks. Besides, up until now, I'd never heard of AT&T graphviz (so there are probably many other MATLAB users that are unaware of it as well - and even after seeing what it has to offer, I'm not convinced it would serve the MATLAB community much better)

Comment only
28 Aug 2007 Kevin Nasman

Why not just use AT&T graphviz? It works well from Matlab.

Comment only
28 Aug 2007 Scott Miller

I'm missing the point of why you are plotting directed graphs using a color code based on the relative magnitudes of the ID numbers and the edge direction rather than plotting arrows based on edge direction. There are several nice routines for plotting arrowheads in the FEX, and this should be an option, if not the default.

Comment only

Contact us