Subject: | SP_Dijkstra() is complaining |
JHI,
SP_Dijkstra is crashing, don't know if this is because of the code itself or if the
documentation on how to use it is incorrect. This should work on undirected graphs, yes?
use strict;
use Graph;
use Digest::MD5;
my $g = Graph::Undirected->new;
my $v1 = Digest::MD5->new();
my $v2 = Digest::MD5->new();
my $v3 = Digest::MD5->new();
my $v4 = Digest::MD5->new();
$g->add_vertices($v1,$v2,$v3,$v4);
$g->add_edges([$v1,$v2],[$v3,$v4],[$v3,$v2]);
my @spd = $g->SP_Dijkstra($v1,$v4);
I see the error message:
Graph::AdjacencyMap::Heavy: arguments 1 expected 2
at /Library/Perl/5.8.6/Graph/AdjacencyMap/Heavy.pm line 184
Graph::AdjacencyMap::Heavy::__attr('Graph::AdjacencyMap::Heavy=ARRAY(0x1a26694)',
'ARRAY(0x188d4c4)') called at /Library/Perl/5.8.6/Graph/AdjacencyMap.pm line 199
Graph::AdjacencyMap::_set_path_attr('undef', 'Digest::MD5=SCALAR(0x1a10798)') called
at /Library/Perl/5.8.6/Graph.pm line 1204
Graph::set_vertex_attribute('Graph::Undirected=ARRAY(0x1a25180)',
'Digest::MD5=SCALAR(0x1a10798)') called at /Library/Perl/5.8.6/Graph.pm line 3121
Graph::_SPT_add('Graph::Undirected=ARRAY(0x1809624)', 'Graph::Undirected=ARRAY
(0x1a25180)', 'Heap::Fibonacci=SCALAR(0x19344c4)', 'Digest::MD5=SCALAR(0x1a10738)',
'weight', 'HASH(0x15fd2fc)', 'HASH(0x199c878)') called at /Library/Perl/5.8.6/Graph.pm line
2243
Graph::_heap_walk('undef', 'undef', 'undef', 'undef', 'first_root', 'Digest::MD5=SCALAR
(0x1a10738)') called at /Library/Perl/5.8.6/Graph.pm line 3138
Graph::SPT_Dijkstra('Graph::Undirected=ARRAY(0x1809624)', 'first_root',
'Digest::MD5=SCALAR(0x1a10738)') called at /Library/Perl/5.8.6/Graph.pm line 3151
Graph::SP_Dijkstra('Graph::Undirected=ARRAY(0x1809624)', 'Digest::MD5=SCALAR
(0x1a10738)', 'Digest::MD5=SCALAR(0x1a10708)') called at Documents/programming/perl/
Graph/make-one.pl line 53
at /Library/Perl/5.8.6/Graph/AdjacencyMap/Heavy.pm line 184
Graph::AdjacencyMap::Heavy::__attr('Graph::AdjacencyMap::Heavy=ARRAY(0x1a26694)',
'ARRAY(0x188d4c4)') called at /Library/Perl/5.8.6/Graph/AdjacencyMap.pm line 199
Graph::AdjacencyMap::_set_path_attr('undef', 'Digest::MD5=SCALAR(0x1a10798)') called
at /Library/Perl/5.8.6/Graph.pm line 1204
Graph::set_vertex_attribute('Graph::Undirected=ARRAY(0x1a25180)',
'Digest::MD5=SCALAR(0x1a10798)') called at /Library/Perl/5.8.6/Graph.pm line 3121
Graph::_SPT_add('Graph::Undirected=ARRAY(0x1809624)', 'Graph::Undirected=ARRAY
(0x1a25180)', 'Heap::Fibonacci=SCALAR(0x19344c4)', 'Digest::MD5=SCALAR(0x1a10738)',
'weight', 'HASH(0x15fd2fc)', 'HASH(0x199c878)') called at /Library/Perl/5.8.6/Graph.pm line
2243
Graph::_heap_walk('undef', 'undef', 'undef', 'undef', 'first_root', 'Digest::MD5=SCALAR
(0x1a10738)') called at /Library/Perl/5.8.6/Graph.pm line 3138
Graph::SPT_Dijkstra('Graph::Undirected=ARRAY(0x1809624)', 'first_root',
'Digest::MD5=SCALAR(0x1a10738)') called at /Library/Perl/5.8.6/Graph.pm line 3151
Graph::SP_Dijkstra('Graph::Undirected=ARRAY(0x1809624)', 'Digest::MD5=SCALAR
(0x1a10738)', 'Digest::MD5=SCALAR(0x1a10708)') called at Documents/programming/perl/
Graph/make-one.pl line 53
Debugged program terminated. Use q to quit or R to restart,
Mac OS 10.4.4
135 ~>perl -V
Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
Platform:
osname=darwin, osvers=8.0, archname=darwin-thread-multi-2level
uname='darwin b31.apple.com 8.0 darwin kernel version 8.0.0: sat mar 26 14:15:22 pst
2005; root:xnu-792.obj~1release_ppc power macintosh powerpc '
config_args='-ds -e -Dprefix=/usr -Dccflags=-g -pipe -Dldflags=-Dman3ext=3pm -
Duseithreads -Duseshrplib'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp -fno-strict-
aliasing -I/usr/local/include',
optimize='-Os',
cppflags='-no-cpp-precomp -g -pipe -fno-common -DPERL_DARWIN -no-cpp-precomp
-fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build 1809)',
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='-L/usr/local/lib'
libpth=/usr/local/lib /usr/lib
libs=-ldbm -ldl -lm -lc
perllibs=-ldl -lm -lc
libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true, libperl=libperl.dylib
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-bundle -undefined dynamic_lookup -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT
Locally applied patches:
23953 - fix for File::Path::rmtree CAN-2004-0452 security issue
33990 - fix for setuid perl security issues
Built under darwin
Compiled at Aug 21 2005 17:14:55
%ENV:
PERL5LIB="/usr/local/GUS/gus_home/lib/perl:/Users/bosborne/bioperl-live:~/bioperl-
db:~/bioperl-ext"
@INC:
/usr/local/GUS/gus_home/lib/perl
/Users/bosborne/bioperl-live
~/bioperl-db
~/bioperl-ext
/System/Library/Perl/5.8.6/darwin-thread-multi-2level
/System/Library/Perl/5.8.6
/Library/Perl/5.8.6/darwin-thread-multi-2level
/Library/Perl/5.8.6
/Library/Perl
/Network/Library/Perl/5.8.6/darwin-thread-multi-2level
/Network/Library/Perl/5.8.6
/Network/Library/Perl
/System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level
/System/Library/Perl/Extras/5.8.6
/Library/Perl/5.8.1/darwin-thread-multi-2level
/Library/Perl/5.8.1