Vertex in Java using JUNG library -


i trying use jung library visualise basic graph vertices , edges. using example code on website, have following:

import edu.uci.ics.jung.graph.directedsparsegraph; import edu.uci.ics.jung.graph.graph; import edu.uci.ics.jung.graph.undirectedsparsegraph; import java.util.*;  public class graphtest {      public graphtest(){                 graph g = new directedsparsegraph();         vertex v1 = (vertex) g.addvertex(new directedsparsevertex());     vertex v2 = (vertex) g.addvertex(new directedsparsevertex());     } 

however, "vertex" underlined in red , netbeans telling me cannot find symbol. tried importing netbeans suggested no avail, , believe vertex native java. i've no idea i'm going wrong think it's elementary error escaping me.

jung uses generic types, doesn't define vertex type.

what plan put graph?

assuming want strings vertex , integers edges, code should like

graph<string,integer> g = new directedsparsegraph<string,intger>(); g.addvertex("foo"); // return type boolean indicating if vertex in graph g.addvertex("bar"); 

which give graph 2 unconnected vertices.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -