473,581 Members | 2,757 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

graph ADT

Hi

What is the best way to implement a undirected weighted graph ADT in
javascript?

Apr 6 '06 #1
11 3023
An************@ gmail.com wrote on 06 apr 2006 in comp.lang.javas cript:
What is the best way to implement a undirected weighted graph ADT in
javascript?


Telling us what you are talking about?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 6 '06 #2
Sorry

I'm writing an extension to firefox where I want to grade all links on
the pages the user visits and then store this information in a weighted
graph (grade as edges, uri as nodes), to make it possible to find the
"best" link on the page or calculate the median grade of the path
between to pages the user has visited, etc.

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.

Apr 6 '06 #3
An************@ gmail.com wrote on 06 apr 2006 in comp.lang.javas cript:
Sorry
Please quote what you are replying to. If you want to post a followup via
groups.google.c om, don't use the "Reply" link at the bottom of the article.
Click on "show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
<http://www.safalra.com/special/googlegroupsrep ly/>

I'm writing an extension to firefox where I want to grade all links on
the pages the user visits and then store this information in a weighted
graph (grade as edges, uri as nodes), to make it possible to find the
"best" link on the page or calculate the median grade of the path
between to pages the user has visited, etc.
Clientside drawing of graphs is possible,
but should be carfully cross-browser designed.

An IE example of mine from 2003:

<http://devrijehuisarts .org/test/jsgraph.asp>

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.


'Graph datastructures' and 'adjacency matrices', do you need such beasts?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 6 '06 #4
Evertjan. skrev:
An************@ gmail.com wrote on 06 apr 2006 in comp.lang.javas cript:
I'm writing an extension to firefox where I want to grade all links on
the pages the user visits and then store this information in a weighted
graph (grade as edges, uri as nodes), to make it possible to find the
"best" link on the page or calculate the median grade of the path
between to pages the user has visited, etc.


Clientside drawing of graphs is possible,
but should be carfully cross-browser designed.

An IE example of mine from 2003:

<http://devrijehuisarts .org/test/jsgraph.asp>


I dont want to draw graphs just store data in them i.e the
datastructure graph and then be able to traverse it depending on the
values of the edges.

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.


'Graph datastructures' and 'adjacency matrices', do you need such beasts?


Not sure there may be some better way to implement it. It's just that a
graph seemed like the natural choice since the internet already is a
graph.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)


Apr 6 '06 #5
An************@ 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?
PointedEars
Apr 6 '06 #6
Thomas 'PointedEars' Lahn wrote:
An************@ 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?


Sorry, I overlooked "undirected ".
PointedEars
Apr 6 '06 #7
Thomas 'PointedEars' Lahn skrev:
Thomas 'PointedEars' Lahn wrote:
An************@ 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


Apr 6 '06 #8
An************@ gmail.com wrote on 06 apr 2006 in comp.lang.javas cript:
It's just that a
graph seemed like the natural choice since the internet already is a
graph.


Are you sure?

I did not know I was sending my email on a graph,
reading usenet on a graph,
and more recently browse the www on a graph!

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 6 '06 #9
Evertjan. skrev:
An************@ gmail.com wrote on 06 apr 2006 in comp.lang.javas cript:
It's just that a
graph seemed like the natural choice since the internet already is a
graph.


Are you sure?

I did not know I was sending my email on a graph,
reading usenet on a graph,
and more recently browse the www on a graph!


I'm not sure if we are thinking of the same kind of graph... I mean
that the www is a directed graph with the urls as nodes and the links
as edges of the graph

i.e this kind of graph: http://en.wikipedia.org/wiki/Graph_theory

Apr 6 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2893
by: Lilith | last post by:
Is there a python module somewhere (been searching today, no luck) which has efficiently coded various graph-handling routines, such as finding the shortest path through a graph, or the set of all paths through a graph? I'm not a compsci-educated person, so coding my own would be less parsimonious. Thanks for any suggestions! D
25
3773
by: Magnus Lie Hetland | last post by:
Is there any interest in a (hypothetical) standard graph API (with 'graph' meaning a network, consisting of nodes and edges)? Yes, we have the standard ways of implementing graphs through (e.g.) dicts mapping nodes to neighbor-sets, but if one wants a graph that's implemented in some other way, this may not be the most convenient (or...
1
4378
by: entropy123 | last post by:
Hey all, In an effort to solve a sticky - for me - problem I've picked up Sedgewick's 'Algorithm's in C'. I've tried working through the first few problems but am a little stumped when he refers to #include "Graph.h" in the header file of the first program. The style he uses to make his declarations is a little unfamiliar to me, but here...
2
2871
by: MLH | last post by:
A97 Am having difficulty displaying graph in Form View that I see fine in graph control on form opened in design view. I know I'm doing something wrong. If I open the form in design view - I see the graph in the graph control. If I dbl-clik the graph control, microsoft graph opens and displays the graph fine there too.
0
2347
by: mylog | last post by:
I have downloaded a GLEE(Graph Layout Execution Engine) and written the following code to display a windows form from a web page but i am encountering with a small problem on displaying the graph into the display and I am getting the following error when I run the web page.Can anybody solve this problem. I would be very grateful. Thanks Error:...
2
4127
by: sriniwas | last post by:
Hi Frnd's, m using prefuse visulation,it's have one display class and this class have one saveImage(outPutStream, String jpg,double size);. now graph is converting ia jpg image properly.now my problem is tht,If graph is to large if it going out of screen thn ,i m getting jpg image on screen disply graph,m not getting the image of tht graph...
4
2544
by: Man4ish | last post by:
namespace ve/////////////////ve.h { struct VertexProperties { std::size_t index; boost::default_color_type color; }; } /////////////////////////////////////////////////////////////////////////////////////////////////// namespace ed///////////////////////ed.h
2
2302
by: Man4ish | last post by:
I have created Graph object without vertex and edge property.It is working fine. #include <boost/config.hpp> #include <iostream> #include <vector> #include <string> #include <boost/graph/adjacency_list.hpp> #include <boost/tuple/tuple.hpp> #include <set> using namespace std;
1
1850
by: Man4ish | last post by:
I am creating a graph using boost library, I am making the network using create_Network function() i am adding the vertices to this graph by creating the object g of class Graph. I am trying to use this object g in the another function get_neighbours() but it is not giving any result.Should I make it global or should use constructor so that...
0
3470
by: eureka2050 | last post by:
Hi all, I am creating a radar chart containing 2 plots using jpgraph. My code is as follows:- include ("./jpgraph/src/jpgraph.php"); include ("./jpgraph/src/jpgraph_radar.php"); // Create the basic radar graph $graph = new RadarGraph(700,500,"auto");
0
7876
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7804
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7910
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5366
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3832
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2307
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1409
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1144
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.