Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #1304

Combinatorica

From janos <janostothmeister@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Combinatorica
Date 2011-03-31 08:58 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <in1fno$4c5$1@smc.vnet.net> (permalink)

Show all headers | View raw


We have a lot of serious problems with Combiantorica, the main one
being the ConnectedComponents and HamiltonianQ cannot be used
together. Here is the content of our notebook. (By the way, is there
any way attachig a file here? Seems to be an old problem.)

At first a graph is constructed

L = Graph[{1 \[UndirectedEdge] 2, 1 \[UndirectedEdge] 3,
   2 \[UndirectedEdge] 3, 2 \[UndirectedEdge] 4, 2 \[UndirectedEdge]
6,
   3 \[UndirectedEdge] 5, 3 \[UndirectedEdge] 7, 4 \[UndirectedEdge]
6,
   5 \[UndirectedEdge] 7, 6 \[UndirectedEdge] 7, 6 \[UndirectedEdge]
8,
   7 \[UndirectedEdge] 8}]

{VertexList[L], EdgeList[L], VertexCount[L], EdgeCount[L]}

ConnectedComponents[
 Graph[{1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3, 3 \
[UndirectedEdge] 1,
   4 \[UndirectedEdge] 5}, VertexLabels -> "Name", ImagePadding -> 5]]

am = AdjacencyMatrix[L]

 AdjacencyGraph[AdjacencyMatrix[L]]

FromAdjacencyMatrix and ToAdjacencyMatrix are not built in.

So far so good. Let us invoke the package.

<< Combinatorica`

A lot of functions, like Graph, ConnectedCompomnents will not function
any more.

Graph[{1 \[UndirectedEdge] 2, 1 \[UndirectedEdge] 3, 2 \
[UndirectedEdge] 3,
  2 \[UndirectedEdge] 4, 2 \[UndirectedEdge] 6, 3 \[UndirectedEdge]
5,
  3 \[UndirectedEdge] 7, 4 \[UndirectedEdge] 6, 5 \[UndirectedEdge]
7,
  6 \[UndirectedEdge] 7, 6 \[UndirectedEdge] 8, 7 \[UndirectedEdge]
8}]

ConnectedComponents[
 Graph[{1 \[UndirectedEdge] 2, 2 \[UndirectedEdge] 3, 3 \
[UndirectedEdge] 1,
   4 \[UndirectedEdge] 5}, VertexLabels -> "Name", ImagePadding -> 5]]

ConnectedComponents[L]

HamiltonianQ is avaliable but it does not work

HamiltonianQ[L]

HamiltonianCycle[L]

AdjacencyGraph[am]

FromAdjacencyMatrix[am]

FromAdjacencyMatrix[nam = Normal[am]]

Use of sparse matrices are discouraged, they are incompatible with
Combinatorica.

MatrixForm[am]

HamiltonianQ[AdjacencyGraph[am]]

HamiltonianQ[AdjacencyGraph[nam]]

HamiltonianQ[FromAdjacencyMatrix[nam]]

{V[L], M[L]}

{V[AdjacencyGraph[am]], M[AdjacencyGraph[am]]}

{V[AdjacencyGraph[nam]], M[AdjacencyGraph[nam]]}

{V[FromAdjacencyMatrix[nam]], M[FromAdjacencyMatrix[nam]]}

Back to comp.soft-sys.math.mathematica | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Combinatorica janos <janostothmeister@gmail.com> - 2011-03-31 08:58 +0000
  Re: Combinatorica "Jon Harrop" <usenet@ffconsultancy.com> - 2011-04-02 07:50 +0000

csiph-web