Re: CostOfPath
- To: mathgroup at smc.vnet.net
- Subject: [mg62510] Re: CostOfPath
- From: "Steven Shippee" <droukas at comcast.net>
- Date: Sat, 26 Nov 2005 02:47:10 -0500 (EST)
- References: <dm6fkd$i0b$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
I don't think you have your inputs in proper form.
Please try something like:
In[1]:=
<< DiscreteMath`Combinatorica`
In[4]:=
g = SetEdgeWeights[GridGraph[3, 3],
WeightingFunction -> RandomInteger, WeightRange -> {1, 5}]
In[5]:=
ShowGraph[ g ];
In[6]:=
CostOfPath[g, {1, 2, 3}]
Out[6]=
4
Looks like infinity might be an answer to any set out of bounds?
Hope this helps
Steven Shippee
slshippee at comcast.net
"Bart De Vylder" <bart.de.vylder at pandora.be> wrote in message
news:dm6fkd$i0b$1 at smc.vnet.net...
>I run Windows XP and Mathematica 5.2 (student version).
>
> Can anybody explain the following?
>
> << DiscreteMath`Combinatorica`;
> gr = FromOrderedPairs[{{2, 1}}];
> CostOfPath[gr, {2, 1}]
>
> Out[]= â^z (infinity)
>
> I would expect 1 as answer.
>
> Thanks,
> Bart
>
>