Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Functions such as GraphDistanceMatrix[] or AdjacencyMatrix[] are available without invoking

Needs["GraphUtilities`"]

.

Why isn't the whole package available when Mathematica starts? Are the functions different after having loaded GraphUtilities?

share|improve this question
    
Those are simply different functions with the same name. The package was available in older versions, the built-in functions are new in 8. –  Szabolcs Mar 21 '12 at 10:10

1 Answer 1

up vote 12 down vote accepted

If you look at their Contexts, you'll see that all of them are in the System` context and not the GraphUtilities` context.

Context /@ {GraphDistanceMatrix, CharacteristicPolynomial, AdjacencyMatrix}
Out[1]= {"System`", "System`", "System`"}

Some packages are preloaded when the kernel starts — System` is one of them, whereas GraphUtilities` is not. You can see all packages that are pre-loaded with $Packages

$Packages
Out[2]= {"ResourceLocator`", "DocumentationSearch`", "GetFEKernelInit`",
    "JLink`", "PacletManager`", "WebServices`", "System`", "Global`"}
share|improve this answer
    
@CHM: Which functions are you concerned about. For CharacteristicPolynomial, for example, it $must$ be the System``` context because evaluating ?GraphUtilities``*` does not show any function of the same name in that context. –  murray Mar 21 '12 at 20:02
    
@murray I've noticed that CharacteristicPolynomial[] is not in GraphUtilities. Edited, thanks. I'm concerned not with a particular example, but with the fact that some functions might have two different definitions when loading a package. –  CHM Mar 21 '12 at 20:08
1  
@CHM: Yes, multiple definitions can be a problem. This seems to happen mostly with add-on packages that are still shipped with Mathematica but whose functions have not yet been moved into the kernel. Of course if you load a package and get shadowing messages, that's a sure tip-off. And you can always qualify the name of a function provided in a package by including the package's context when calling it. –  murray Mar 22 '12 at 0:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.