Group Abstract Group Abstract

Message Boards Message Boards

0
|
4.3K Views
|
3 Replies
|
3 Total Likes
View groups...
Share
Share this post:

Confused with Graph Command

Posted 11 years ago
POSTED BY: Gilbert Gosseyn
3 Replies

Hi GG,

you could also call any conflicting or shadowing symbols by their full names, that is, including the name of their context:

Combinatorica`Graph

is not the same as

System`Graph

as you can see by evaluating their respective usage messages:

?Combinatorica`Graph
?System`Graph

I admit that this is a bit cumbersome because of the additional typing work, but it will allow you to access functions of the same name coming from different packages in a controlled way.

~ Bianca

POSTED BY: Bianca Eifert

Hi GG,

I think that it is a little bit of a problem to use functionality from both graphutilities and combinatorica at the same time. As the error message says combinatorica is conflicting with the built-in functionality.

I did manage to use functionality from both in one notebook, and switch between the packages, using CleanSlate: http://library.wolfram.com/infocenter/TechNotes/4718/

This piece of code should work after CleanSlate is installed.

(*goto http://library.wolfram.com/infocenter/TechNotes/4718/ and \ follow the instructions*)

In[1]:= ClearAll["Global`*"]

In[2]:= RandomGraph[{20, 50}]

In[3]:= << Utilities`CleanSlate`

In[4]:= Needs << Combinatorica`

In[6]:= GraphPlot[RandomGraph[50, 0.1]]

In[7]:= Names["Combinatorica`*"]

In[9]:= g = RandomGraph[50, 0.1]

In[10]:= ListPlot[DegreeSequence[g]]

In[11]:= CleanSlate["Combinatorica`"]

During evaluation of In[11]:=   (CleanSlate) Contexts purged: {Combinatorica`}

During evaluation of In[11]:=   (CleanSlate) Approximate kernel memory recovered: 2999 Kb

Out[0]= {"Utilities`CleanSlate`", "TemplatingLoader`", \
"PacletManager`", "System`", "Global`"}

In[1]:= RandomGraph[{20, 50}]

It is important that you load "CleanSlate", before (!) you load Combinatorica. After that you can (in theory) load and unload Combinatorica functionality. The notebook is attached as well. This is not a good solution to your problem, but it might be a first step.

Cheers,

Marco

Attachments:
POSTED BY: Marco Thiel
POSTED BY: Udo Krause
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard