Java GraphStream-使用netstream的问题
我使用的是以下代码中给出的标准示例,但java应用程序返回以下错误:Java GraphStream-使用netstream的问题,java,c++,graphstream,Java,C++,Graphstream,我使用的是以下代码中给出的标准示例,但java应用程序返回以下错误: [//NetStreamDecoder | NetStreamReceiver: Don't know this command: 0] 我一直在使用以下工具编译java示例: javac -cp lib/gs-core-1.2.jar:. ExampleReceiver.java < > C++提供的发送器。如何在Java应用程序中看到更新?提前谢谢 Example.java import java.io.IOExcep
[//NetStreamDecoder | NetStreamReceiver: Don't know this command: 0]
我一直在使用以下工具编译java示例:
javac -cp lib/gs-core-1.2.jar:. ExampleReceiver.java
< > C++提供的发送器。如何在Java应用程序中看到更新?提前谢谢
Example.java
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
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++);
}
< > NETSt流的C++和Python版本与GS核心版本1.2的实现不同步。我们必须更新C++和Python实现。
同时,您可以使用较旧版本的gs core。我建议从github存储库中检出版本a3f70d2 谢谢,我这段时间去看看。我觉得我有点不对劲。正在等待新发行版!:)现在C++实现与GS核心、V 1.2和Git同步。