I'm new in using JUNG, so I still have some doubts.
I'm to try create de graph from file, but i have some doubts, and i don't know solve my problem
I'm read the file similar the following
v_source,v_destine,Hit,media
1,2,1,415
1,3,2,302
1,4,4813,10.3897776854
1,5,386,14.603626943
2,3,235,39.3361702128
2,4,1,1520
2,8,33,81.5757575758
2,12,13,389.4615384615
2,13,2,758.5
2,14,3,68
3,1,5,29.2
3,2,288,37.6701388889
3,4,24,9.6666666667
3,5,5,78.4
3,12,2718,13.3142016188
I need painting two network graph, using this information.
I have the next code but not solve the my problem,
The first problem i have is the create the node when the hits is the same, not create the graph
public class SimpleGraphView1 {
Graph<Integer, String> g;
/** Creates a new instance of SimpleGraphView */
public SimpleGraphView1() {
File file = new File("/home/ricardosousa/Desktop/Results/test2.csv");
// Graph<V, E> where V is the type of the vertices and E is the type of the edges
g = new SparseMultigraph<Integer, String>();
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(file));
String line = null;
while ((line = br.readLine()) != null) {
String values = line.split(",");
int x = values.length;
System.out.println(x);
String hit=values;
int source=Integer.parseInt(values.toString());
int target=Integer.parseInt(values.toString());
How is it possible to create a graph of the network, how much greater the number of hits more nearest are nodes.
And create another graph and how much less the average value more nearest are nodes.
In the second graph the ideia is create cluster if value average less 100
How change my code for make do this, because i have dificulties in create edges the way automatic when reading the file
Thanks,
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ood Afternoon,
I'm new in using JUNG, so I still have some doubts.
I'm to try create de graph from file, but i have some doubts, and i don't know solve my problem
I'm read the file similar the following
v_source,v_destine,Hit,media
1,2,1,415
1,3,2,302
1,4,4813,10.3897776854
1,5,386,14.603626943
2,3,235,39.3361702128
2,4,1,1520
2,8,33,81.5757575758
2,12,13,389.4615384615
2,13,2,758.5
2,14,3,68
3,1,5,29.2
3,2,288,37.6701388889
3,4,24,9.6666666667
3,5,5,78.4
3,12,2718,13.3142016188
I need painting two network graph, using this information.
I have the next code but not solve the my problem,
The first problem i have is the create the node when the hits is the same, not create the graph
public class SimpleGraphView1 {
Graph<Integer, String> g;
/** Creates a new instance of SimpleGraphView */
public SimpleGraphView1() {
File file = new File("/home/ricardosousa/Desktop/Results/test2.csv");
// Graph<V, E> where V is the type of the vertices and E is the type of the edges
g = new SparseMultigraph<Integer, String>();
BufferedReader br = null;
try {
br = new BufferedReader(new FileReader(file));
String line = null;
while ((line = br.readLine()) != null) {
String values = line.split(",");
int x = values.length;
System.out.println(x);
String hit=values;
int source=Integer.parseInt(values.toString());
int target=Integer.parseInt(values.toString());
g.addEdge(hit, source, target);
System.out.println();
}
}
catch (FileNotFoundException ex) {
ex.printStackTrace();
}
catch (IOException ex) {
ex.printStackTrace();
}
finally {
try {
if (br != null)
br.close();
}
catch (IOException ex) {
ex.printStackTrace();
}
}
}
public static void main(String args) {
SimpleGraphView1 sgv = new SimpleGraphView1();
Layout<Integer, String> layout = new CircleLayout(sgv.g);
layout.setSize(new Dimension(300,300));
VisualizationViewer<Integer,String> vv = new VisualizationViewer<Integer,String>(layout);
vv.setPreferredSize(new Dimension(350,350));
vv.getRenderContext().setVertexLabelTransformer(new ToStringLabeller());
vv.getRenderContext().setEdgeLabelTransformer(new ToStringLabeller());
PluggableGraphMouse gm = new PluggableGraphMouse();
gm.add(new TranslatingGraphMousePlugin(MouseEvent.BUTTON1_MASK));
gm.add(new ScalingGraphMousePlugin(new CrossoverScalingControl(), 0, 1.1f, 0.9f));
vv.setGraphMouse(gm);
JFrame frame = new JFrame("Interactive Graph View 3");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(vv);
frame.pack();
frame.setVisible(true);
}
}
How is it possible to create a graph of the network, how much greater the number of hits more nearest are nodes.
And create another graph and how much less the average value more nearest are nodes.
In the second graph the ideia is create cluster if value average less 100
How change my code for make do this, because i have dificulties in create edges the way automatic when reading the file
Thanks,