GraphUtilities`
GraphUtilities`

AdjacencyMatrix

As of Version 10, all the functionality of the GraphUtilities package is built into the Wolfram System. »

AdjacencyMatrix[g]

gives the SparseArray object representing the graph g.

AdjacencyMatrix[g,n]

gives the SparseArray object representing the graph g, adding additional unconnected vertices, if necessary, to create a graph with n vertices.

更多信息和选项

  • AdjacencyMatrix functionality is now available in the built-in Wolfram Language function AdjacencyMatrix.
  • To use AdjacencyMatrix, 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].

范例

打开所有单元关闭所有单元

基本范例  (2)

The adjacency matrix of a graph specified by a rule list:

This function has been superseded by AdjacencyMatrix in the Wolfram System:

Scope  (2)

The SparseArray representation of a graph specified by a rule list:

This adds an extra row and column to the adjacency matrix, corresponding to unconnected vertices:

Properties & Relations  (2)

This gives a SparseArray representation of a graph specified by a Combinatorica object:

This shows the MatrixPlot of the adjacency matrix of a GridGraph, and its graph drawing:

Possible Issues  (1)

A second argument specifying fewer vertices than those contained in the graph is ignored:

Wolfram Research (2007),AdjacencyMatrix,Wolfram 语言函数,https://reference.wolfram.com/language/GraphUtilities/ref/AdjacencyMatrix.html.

文本

Wolfram Research (2007),AdjacencyMatrix,Wolfram 语言函数,https://reference.wolfram.com/language/GraphUtilities/ref/AdjacencyMatrix.html.

CMS

Wolfram 语言. 2007. "AdjacencyMatrix." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/GraphUtilities/ref/AdjacencyMatrix.html.

APA

Wolfram 语言. (2007). AdjacencyMatrix. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/GraphUtilities/ref/AdjacencyMatrix.html 年

BibTeX

@misc{reference.wolfram_2024_adjacencymatrix, author="Wolfram Research", title="{AdjacencyMatrix}", year="2007", howpublished="\url{https://reference.wolfram.com/language/GraphUtilities/ref/AdjacencyMatrix.html}", note=[Accessed: 18-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_adjacencymatrix, organization={Wolfram Research}, title={AdjacencyMatrix}, year={2007}, url={https://reference.wolfram.com/language/GraphUtilities/ref/AdjacencyMatrix.html}, note=[Accessed: 18-November-2024 ]}