首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >GraphStream -使用网络流的问题

GraphStream -使用网络流的问题
EN

Stack Overflow用户
提问于 2013-12-29 19:17:33
回答 1查看 344关注 0票数 1

我使用的是一个标准示例,在下面的代码中给出,但是java应用程序返回以下错误:

代码语言:javascript
复制
[//NetStreamDecoder | NetStreamReceiver: Don't know this command: 0]

我一直在用以下方法编译java示例:

代码语言:javascript
复制
javac -cp lib/gs-core-1.2.jar:. ExampleReceiver.java

而C++发送方是https://github.com/graphstream/gs-netstream中提供的发送方。如何在Java应用程序中看到更新?提前谢谢。

Example.java

代码语言:javascript
复制
import java.io.IOException;
import java.net.UnknownHostException;

import org.graphstream.graph.Graph;
import org.graphstream.graph.implementations.MultiGraph;
import org.graphstream.stream.netstream.packing.Base64Unpacker;
import org.graphstream.stream.netstream.NetStreamReceiver;
import org.graphstream.stream.thread.ThreadProxyPipe;

public class ExampleReceiver {

    public static void main(String[] args) throws UnknownHostException, IOException, InterruptedException {

        Graph g = new MultiGraph("G",false,true);
        g.display();
        NetStreamReceiver net = new NetStreamReceiver(2001);

        ThreadProxyPipe pipe = net.getDefaultStream();
        pipe.addSink(g);
        while (true) {
            pipe.pump();
            Thread.sleep(100);
        }
    }
}

gs-netstream/cpp/src/netstream-main.cpp

代码语言:javascript
复制
void events_test(){
  string source_id="C++_netstream_test";
  long time_id=0L;
  NetStreamSender stream("localhost", 2001);
  stream.addNode(source_id, time_id++, "node0");
  stream.addEdge(source_id, time_id++, "edge", "node0", "node1", true);
  stream.addNodeAttribute(source_id, time_id++, "node0","nodeAttribute", 0);
  stream.changeNodeAttribute(source_id, time_id++, "node0","nodeAttribute",0, 1);
  stream.removeNodeAttribute(source_id, time_id++, "node0","nodeAttribute");
  stream.addEdgeAttribute(source_id, time_id++, "edge","edgeAttribute", 0);
  stream.changeEdgeAttribute(source_id, time_id++, "edge","edgeAttribute", 0,1);
  stream.removeEdgeAttribute(source_id, time_id++, "edge","edgeAttribute");
  stream.addGraphAttribute(source_id, time_id++, "graphAttribute", 0);
  stream.changeGraphAttribute(source_id, time_id++, "graphAttribute", 0, 1);
  stream.removeGraphAttribute(source_id, time_id++, "graphAttribute");
  stream.stepBegins(source_id, time_id++, 1.1);
  stream.removeEdge(source_id, time_id++, "edge");
  stream.removeNode(source_id, time_id++, "node0");
  stream.graphClear(source_id, time_id++);
}
EN

回答 1

Stack Overflow用户

发布于 2014-03-03 15:07:29

C++和python版本的NetStream与gs核心版本1.2中的实现不同步。我们必须更新C++和python实现。

同时,您可以使用较早版本的gs-core。我建议查看github存储库中的修订版a3f70d2。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20829091

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档