I have constructed a random graph with Mathematica using the RandomGraph command. Now I would like to convert this graph to a matrix, but I don't know how. The command //MatrixForm just shows the same with "//MatrixForm" so that doesn't help to much either.
Tell me more
×
Mathematica Stack Exchange is a question and answer site for
users of Mathematica. It's 100% free, no registration required.
|
|
||||
|
Please see Graphs and Matrices guide page for related functionality. Below is usage summary. This is creates a random graph with 9 vertexes and edge 0.4 probability.
And these are matrix types that you can get from your graph:
There is also |
||||
|
|



AdjacencyMatrix? Also posting your code would be really useful. – Vitaliy Kaurov Aug 30 '12 at 14:53Normalif you want to convert the Sparse matrix to normal matrixNormal@AdjacencyMatrix[RandomGraph[{5, 6}]]– Nasser Aug 30 '12 at 15:00MatrixFormis meant for pretty printing things that are already matrices. – Sjoerd C. de Vries Aug 30 '12 at 15:20Normal[]might not always be a good idea, if the matrix has particularly large dimensions... – J. M.♦ Aug 30 '12 at 15:27