yields True if the graph g is a weighted graph and False otherwise.


  • WeightedGraphQ will give True if there is an explicit VertexWeight or EdgeWeight property defined.
  • In cases where a weighted graph is expected, the default vertex and edge weights are taken to be 1.
  • Weights are often taken to mean cost, capacity, etc.


open allclose all

Basic Examples  (2)

Test whether a graph is a weighted graph:

Test matrix graphs:

Scope  (4)

Test undirected and directed graphs:

Detect edge weights:

Detect vertex weights:

WeightedGraphQ gives False for anything that is not a weighted graph:

Test large graphs:

Possible Issues  (1)

WeightedGraphQ gives False for non-explicit graphs:

Introduced in 2010