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.

I am trying to use the Combinatorica package in a Mathematica version 8 in the following code:

gp = Graph[{1-> 3, 1 -> 2, 3 ->1}]
<< Combinatorica`
ConnectedQ[gp]

But this gives me an error message:

General::compat: Combinatorica Graph and Permutations functionality has been superseded by preloaded functionality. The package now being loaded may conflict with this. Please see the Compatibility Guide for details.

I have checked the guide but, the recommendation given could not solve this problem.

Any suggestion please?

share|improve this question
    
Do not load Combinatorica, it's mostly obsolete for graphs and if you're not careful, it'll conflict with built-in functionality in v8. Just use ConnectedGraphQ[gp]. –  Szabolcs Feb 17 at 17:58
1  
@John: Welcome to the site! Please consider registering your account! –  belisarius Feb 17 at 19:04
add comment

2 Answers

This is the way to do it if you really need to use the Combinatorica package:

<< Combinatorica`
gpc = Combinatorica`FromOrderedPairs[{{1, 3}, {1, 2}, {3, 1}}];
Combinatorica`StronglyConnectedComponents[gpc]
(* {{1, 3}, {2}}*)
share|improve this answer
    
BTW, don't even try to learn how to use Combinatorica from the docs. Better get a book like this one amazon.com/… –  belisarius Feb 17 at 21:40
add comment

Combinatorica is mostly obsoleted by version 8's built-in Graph data structure and the related functions. Do not load Combinatorica in v8 or later, unless you need functionality that is not available built-in and you know how to work around the name conflicts between Combinatorica and built-in functions.

In this case just use

ConnectedGraphQ[gp]
share|improve this answer
add comment

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.