MATLAB: How to construct the g in matgraph for coloring graphs

matgraphMATLAB

please help me in constructing the g graph, to use the matgraph codes to draw the colored graph. How do I enter g into the codes? please give me an example of a simple g used on matgraph and the resulting graph coloring from color(g) and cdraw(g)? Is g a nx2 matrices?

Best Answer

g is an object created by the graph() constructor. You can construct it as empty and use one of the routines such as bucky() to replace it with a special graph, or you can construct it with an n x 2 edge list; see http://www.mathworks.com/matlabcentral/fileexchange/19218-matgraph/content/matgraph/html/matgraph/@graph/graph.html
For example,
list = randi(5, 7, 2);
g = graph(list);