# Graphs in Matlab

• 12-16-2010
anirban
Graphs in Matlab
Can anyone please throw some light on how to create graphs (GRAPH THEORY) in Matlab?
• 12-16-2010
tabstop
Last time I did it, it was adjacency matrices all the way.
• 12-16-2010
Epy
like X-Y plots?

x=0:0.01:5;
y=sin(x);
plot(x,y)
• 12-16-2010
User Name:
Epy, he's talking about graphs like those used in graph theory. What you are talking about are called graphs of a function. Unlike graphs on a function, which are for modeling trends and linear relations, graphs in graph theory are for showing relations between nodes or vertices. Discrete math is the closest relative of CS in math, you should consider studying it. I know you've heard of Dijkstra's shortest path finding algo, it's a solution to the problem of path finding in graph theory. You've probably also heard of four color theorem, it is from graph theory.
• 12-16-2010
anirban
If I want to implement Adjacency Lists.
How can I do so?
• 12-17-2010
tabstop
Quote:

Originally Posted by anirban
If I want to implement Adjacency Lists.
How can I do so?

The best thing I can think of, on the assumption that Matlab lets you do it (which I don't know), is to do a vector of vectors. (I get the sneaking suspicion that, for Matlab, a "vector of vectors" is really a matrix.)
• 12-17-2010
Epy
• 12-19-2010
anirban
Many thanks!