|
SOLUTIONS
|
GRAPH UTILITIES 程序包 符号
AdjacencyMatrix
AdjacencyMatrix[g]
gives the SparseArray object representing the graph g.
gives the SparseArray object representing the graph g, adding additional unconnected vertices, if necessary, to create a graph with n vertices.
更多信息更多信息
- To use
, you first need to load the Graph Utilities Package using Needs["GraphUtilities`"]. - The graph g can be specified by a rule list, an adjacency matrix, or the Combinatorica representation of a graph.
- The rows/columns of the SparseArray object correspond to vertices in the order returned by VertexList[g].
范例范例打开所有单元关闭所有单元
基本范例 (3)基本范例 (3)
| In[1]:= |
The SparseArray representation of a graph specified by a rule list:
| In[2]:= |
Out[2]//MatrixForm= | |
| In[1]:= |
This gives a SparseArray representation of a graph specified by a Combinatorica object:
| In[2]:= |
| Out[2]= |
| In[3]:= |
Out[3]//MatrixForm= | |
![]() | |
| In[1]:= |
This adds an extra row and column to the adjacency matrix, corresponding to unconnected vertices:
| In[2]:= |
| In[3]:= |
Out[3]//MatrixForm= | |
![]() | |
| In[4]:= |
| Out[4]= | ![]() |
Mathematica 9 is now available!
New to Mathematica?
Find your learning path »
Have a question?
Ask support »



