Graph
hi everyone i'm currently working on graph program,i dont want to
draw a graph. but i want to use vectors to display the edges
that are connected to each other in a URL.
so basically the nodes will be the links and i have to display what links are connected to each other.
I have created the following program
import java.util.*;
import java.io.*;
class graph {
Vector nodes=new Vector();
Vector edges=new Vector();
public graph() {
Vector nodes=new Vector();
Vector edges=new Vector();
graph g;}
graph addnode(Object x) { if (!nodes.contains(x)) {nodes.addElement(x);
Vector w=new Vector();
edges.addElement(w); } return(new graph(nodes,edges)); }
graph addedge(Object start, Object finish) {
if (nodes.contains(start) && nodes.contains(finish))
{
int posOfStart=nodes.indexOf(start);
int posOfFinish=nodes.indexOf(finish);
Vector w = (Vector)(edges.elementAt(posOfStart));
w.addElement(new Integer(posOfFinish));
nodes.setElementAt(w,posOfStart);
}
return new graph(); }
//toString() { }
public static void main(String [ ] args) { graph g = new graph(); g.addnode("****");
g.addedge("****","****"); }
}
but i keep getting errors as follows:
C:\jdk1.2.1\graph.java:13: Wrong number of arguments in constructor.
edges.addElement(w); } return(new graph(nodes,edges)); }
^
1 error
Tool completed with exit code 1
What i want is for user to enter a URL and integer (whihc represents
the level of depth in the URL) and for the program to display
what links are connected to each other
help>
thank you very much for your help in advance

