This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

WeightedGraphQ

WeightedGraphQ[g]
yields True if the graph g is a weighted graph and False otherwise.
  • In cases where a weighted graph is expected, the default vertex and edge weights are taken to be .
  • Weights are often taken to mean cost, capacity, etc.
Test whether a graph is a weighted graph:
Test matrix graphs:
Test whether a graph is a weighted graph:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
 
Test matrix graphs:
In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
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:
WeightedGraphQ gives False for non-explicit graphs:
New in 8