- From: Yoann Pigné <yoann.pigne AT gmail.com>
- To: "graphstream-users AT litislab.fr" <graphstream-users AT litislab.fr>, mhn.namak AT gmail.com
- Subject: Re: getting information of new added/deleted edges
- Date: Thu, 11 Aug 2016 10:40:36 +0200
Hi,
In your case I guess you don’t even need a Graph object. You only need a sink
that filters all but the "edge added" events. The Sink interface has such an
event. You just need to implement it.
For sake of simplicity, in the following example the SinkAdapter class that
implements all of the Sink methods is used. Then we just need to override
the edgeAdded method.
https://gist.github.com/pigne/e81075590fd5a5b43a00d3c663a8a236
Yoann
>
On Aug 11, 2016, at 5:03 AM,
>
<mhn.namak AT gmail.com>
>
>
<mhn.namak AT gmail.com>
>
wrote:
>
>
Hi all,
>
I want to use "graphstream" software to get a synthetic graph stream.
>
However,
>
I don't need to visualize it. I just want to get the new edges/nodes per
>
request or in a batch mode.
>
>
My requirement is like the following:
>
- the graph model (e.g. BarabasiAlbert, ....)
>
- number of node/edges in total.
>
- streaming of edges in an ordered manner
>
>
The following code gives me the graph. However, in each event, I don't know
>
what are the new edges to have their order.
>
Is there any method that I can use to see what is the srcNodeId -->
>
destNodeId
>
of the next streaming edge?
>
>
Graph graph = new SingleGraph("test1");
>
Generator generator = new
>
BarabasiAlbertGenerator(maxEdgePerEvent);
>
>
generator.addSink(graph);
>
generator.begin();
>
>
>
for (int i = 0; i < numberOfNodes; i++) {
>
generator.nextEvents(); //which edges/nodes were
>
added?
>
}
>
>
>
for (Node node : graph) {
>
node.addAttribute("ui.label", node.getId());
>
}
>
>
Thanks
Archives gérées par MHonArc 2.6.16.