Re: graph ADT
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: graph ADT

From: <Andreas.Burman@gmail.com>
Date: Thu Apr 06 2006 - 16:47:29 CEST

Thomas 'PointedEars' Lahn skrev:

> Thomas 'PointedEars' Lahn wrote:
>
> > Andreas.Burman@gmail.com wrote:
> >> What I want to know is how to implement the graph datastructure in
> >> javascript in the most efficient way (performance wise and to some
> >> extent also memory wise). I was thinking on using an adjacency matrix
> >> but it would probably be to sparse since most urls on the web are not
> >> connected to each other, and I wonder if someone had an better idea.
> >
> > var node1 = {target: null};
> > var node2 = {target: node1, weight: 1};
> >
> > Got the idea?

Not quite, I understand how that work if each node only is connected to
one node but how does it work in the following example:

<ascii graphic warning>

                         w1:2, w2:45, w3:34
                       |------------------> www.abc.com ->...
                       | w1:6, w2:1, w3:234
http://www.google.com -|------------------> www.def.com ->...
                       | w1:7, w2:6, w3:1
                       |------------------> www.ghi.com ->...

</acsii graphic warning>

As you can see I alsa need more then one weight value on each edge.

> Sorry, I overlooked "undirected".

No my fault I meant directed.

> PointedEars
Received on Mon May 1 04:45:39 2006