Student Support Forum: 'show gridgraph with FromadjacencyMatrix' topicStudent Support Forum > General > "show gridgraph with FromadjacencyMatrix"

 Next Comment > Help | Reply To Topic
 Author Comment/Response Zhiyu Fan 09/09/10 09:19am Hallo All, we can show a GridGraph with e.g. g=GridGraph[3,3] ShowGraph[g] with help of AdjacencyMatrix we could get the adjacent matrix of the graph g, In[217]= adm = ToAdjacencyMatrix[g] Out[217]= {{0, 1, 0, 1, 0, 0, 0, 0, 0}, {1, 0, 1, 0, 1, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 1, 0, 0}, {0, 1, 0, 1, 0, 1, 0, 1, 0}, {0, 0, 1, 0, 1, 0, 0, 0, 1}, {0, 0, 0, 1, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 1, 0, 1, 0, 1}, {0, 0, 0, 0, 0, 1, 0, 1, 0}} then i changed a few value in the adjacent matrix. adm = {{0, 1, 1, 1, 1, 1, 0, 0, 0}, {1, 0, 1, 0, 1, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 1, 0, 0}, {0, 1, 0, 1, 0, 1, 0, 1, 0}, {0, 0, 1, 0, 1, 0, 0, 0, 1}, {0, 0, 0, 1, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 1, 0, 1, 0, 1}, {0, 0, 0, 0, 0, 1, 0, 1, 0}} Out[220]= {{0, 1, 1, 1, 1, 1, 0, 0, 0}, {1, 0, 1, 0, 1, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 1, 0, 0}, {0, 1, 0, 1, 0, 1, 0, 1, 0}, {0, 0, 1, 0, 1, 0, 0, 0, 1}, {0, 0, 0, 1, 0, 0, 0, 1, 0}, {0, 0, 0, 0, 1, 0, 1, 0, 1}, {0, 0, 0, 0, 0, 1, 0, 1, 0}} so i have a new graph g1 g1= FraomAdjaencyMatrix[adm] and then i will show it like as g ShowGraph[g1, VertexLabel -> True] but the graph will not show like as graph g, because the FromAdjacencyMatrix constructs a graph using a circular embedding. how can i show the new graph g1 like as g (GridGraph) thank you in advances Zhiyu URL: ,

 Subject (listing for 'show gridgraph with FromadjacencyMatrix') Author Date Posted show gridgraph with FromadjacencyMatrix Zhiyu Fan 09/09/10 09:19am Re: show gridgraph with FromadjacencyMatrix Peter Pein 09/09/10 4:32pm Re: Re: show gridgraph with FromadjacencyMatrix Zhiyu Fan 09/13/10 02:18am
 Next Comment > Help | Reply To Topic