Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Mathematics and Algorithms > Graphs & Networks > Graph Predicates and Properties > WeightedGraphQ >
Mathematica > Visualization and Graphics > Graphs & Networks > Graph Predicates and Properties > WeightedGraphQ >

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
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF