GraphTheory
ModularityMatrix
construct modularity matrix
Calling Sequence
Parameters
Options
Description
Definition
Examples
Compatibility
ModularityMatrix(G, opts)
G
-
graph
opts
(optional) one or more options as specified below
datatype=type
Specifies a datatype for the generated Matrix as described in rtable. The default is datatype=anything.
order=one of C_order or Fortran_order
Specifies the order of the generated Matrix. The default is order=C_order.
shape=name or list of names
Specifies the storage allocation for Matrix entries. Must be a name or list of names specifying one or more built-in or user-defined indexing functions. The default is shape=symmetric if G is undirected and shape=[] if G is directed.
ModularityMatrix(G) returns the modularity matrix of a graph G.
The default output is an n by n Matrix with the following properties:
By default datatype=anything and order=C_order
If G is undirected, by default shape=symmetric
If G is directed, by default shape=[]
Let G be a graph and let m be its number of edges. The modularity matrix of G is defined as follows:
If G is undirected, the entry i,j of this matrix is deg[i]*deg[j]/2/m where deg[i] is the degree of vertex i.
If G is directed, the entry i,j of this matrix is indeg[i]*outdeg[j]/m where indeg[i] is the in-degree of vertex i and outdeg[j] is the out-degree of vertex j.
withGraphTheory:
G≔Graph1,2,3,4,Trail1,2,3,4,1
G≔Graph 1: an undirected graph with 4 vertices and 4 edges
ModularityMatrixG
−1212−121212−1212−12−1212−121212−1212−12
The GraphTheory[ModularityMatrix] command was introduced in Maple 2025.
For more information on Maple 2025 changes, see Updates in Maple 2025.
See Also
AdjacencyMatrix
Degree
Download Help Document