2
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ 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]. $\endgroup$
    – Szabolcs
    Feb 17, 2014 at 17:58
  • 1
    $\begingroup$ @John: Welcome to the site! Please consider registering your account! $\endgroup$ Feb 17, 2014 at 19:04

2 Answers 2

2
$\begingroup$

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}}*)
$\endgroup$
1
  • $\begingroup$ BTW, don't even try to learn how to use Combinatorica from the docs. Better get a book like this one amazon.com/… $\endgroup$ Feb 17, 2014 at 21:40
0
$\begingroup$

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]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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