Message Boards Message Boards

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

Confused with Graph Command

Posted 11 years ago

enter image description here

Hi,

There seem to be two different "Graph" commands, although they have the same name. GraphQ does not recognize all graphs. What shall I load in which sequence, if I want to use some commands from graphutilities and from combinatorica? Command AdjacencyMatrix shows the same problem.

Best,

GG

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

The Wolfies say in GraphUtilitiesPackage

As of Version 10, all the functionality of the GraphUtilities package is built into the Wolfram System.

and present a Tutorial Upgrading from GraphUtilities GraphUtilities ensuring again

As of Version 10, all the functionality of the GraphUtilities package is built into the Wolfram System.

So, in the best of all worlds - which is by the way just ours - you are allowed to do nothing about it: do not load GraphUtilities any more.

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

Group Abstract Group Abstract